" A MFTSetPrescriptionTest is a test class for testing the behavior of MFTSetPrescription " Class { #name : 'MFTSetPrescriptionTest', #superclass : 'TestCase', #category : 'MyFitnessTracker-Core-Tests-Prescription', #package : 'MyFitnessTracker-Core-Tests', #tag : 'Prescription' } { #category : 'tests' } MFTSetPrescriptionTest >> testCanonicalNameCombinesRepSchemeAndExerciseNames [ | exercise repScheme prescription | exercise := MFTRepScheme from: 1 to: 1. repScheme := MFTRepScheme from: 6 to: 10. prescription := MFTSetPrescription new. prescription instVarNamed: 'exercise' put: exercise; repScheme: repScheme. self assert: prescription canonicalName equals: '6–10 reps 1–1' ] { #category : 'tests' } MFTSetPrescriptionTest >> testEqualPrescriptionsHaveSameHash [ | exercise repScheme first second | exercise := MFTRepScheme from: 1 to: 1. repScheme := MFTRepScheme from: 6 to: 10. first := MFTSetPrescription new. second := MFTSetPrescription new. first instVarNamed: 'exercise' put: exercise; repScheme: repScheme. second instVarNamed: 'exercise' put: exercise; repScheme: repScheme. self assert: first hash equals: second hash ] { #category : 'tests' } MFTSetPrescriptionTest >> testExerciseInitiallyNil [ | prescription | prescription := MFTSetPrescription new. self assert: prescription exercise isNil ] { #category : 'tests' } MFTSetPrescriptionTest >> testExerciseRepSchemeConstructorSetsExerciseAndRepScheme [ | exercise repScheme prescription | exercise := MFTRepScheme from: 1 to: 1. repScheme := MFTRepScheme from: 6 to: 10. prescription := MFTSetPrescription exercise: exercise repScheme: repScheme. self assert: prescription exercise identicalTo: exercise. self assert: prescription repScheme identicalTo: repScheme ] { #category : 'tests' } MFTSetPrescriptionTest >> testPrescriptionIsNotEqualToDifferentClass [ | prescription | prescription := MFTSetPrescription new. prescription instVarNamed: 'exercise' put: (MFTRepScheme from: 1 to: 1); repScheme: (MFTRepScheme from: 6 to: 10). self deny: prescription equals: Object new ] { #category : 'tests' } MFTSetPrescriptionTest >> testPrescriptionsWithDifferentExerciseAreNotEqual [ | repScheme first second | repScheme := MFTRepScheme from: 6 to: 10. first := MFTSetPrescription new. second := MFTSetPrescription new. first instVarNamed: 'exercise' put: (MFTRepScheme from: 1 to: 1); repScheme: repScheme. second instVarNamed: 'exercise' put: (MFTRepScheme from: 2 to: 2); repScheme: repScheme. self deny: first equals: second ] { #category : 'tests' } MFTSetPrescriptionTest >> testPrescriptionsWithDifferentRepSchemeAreNotEqual [ | exercise first second | exercise := MFTRepScheme from: 1 to: 1. first := MFTSetPrescription new. second := MFTSetPrescription new. first instVarNamed: 'exercise' put: exercise; repScheme: (MFTRepScheme from: 6 to: 10). second instVarNamed: 'exercise' put: exercise; repScheme: (MFTRepScheme from: 8 to: 12). self deny: first equals: second ] { #category : 'tests' } MFTSetPrescriptionTest >> testPrescriptionsWithSameExerciseAndRepSchemeAreEqual [ | exercise repScheme first second | exercise := MFTRepScheme from: 1 to: 1. repScheme := MFTRepScheme from: 6 to: 10. first := MFTSetPrescription new. second := MFTSetPrescription new. first instVarNamed: 'exercise' put: exercise; repScheme: repScheme. second instVarNamed: 'exercise' put: exercise; repScheme: repScheme. self assert: first equals: second ] { #category : 'tests' } MFTSetPrescriptionTest >> testRepSchemeAccessor [ | prescription repScheme | prescription := MFTSetPrescription new. repScheme := MFTRepScheme from: 6 to: 10. prescription repScheme: repScheme. self assert: prescription repScheme identicalTo: repScheme ]