" A MFTRoutineTest is a test class for testing the behavior of MFTRoutine " Class { #name : 'MFTRoutineTest', #superclass : 'TestCase', #category : 'MyFitnessTracker-Core-Tests-Prescription', #package : 'MyFitnessTracker-Core-Tests', #tag : 'Prescription' } { #category : 'tests' } MFTRoutineTest >> testCanonicalNameAnswersTitle [ | routine | routine := MFTRoutine new. routine title: 'Heavy Duty I'. self assert: routine canonicalName equals: 'Heavy Duty I' ] { #category : 'tests' } MFTRoutineTest >> testInitializeCreatesEmptyWorkoutCollection [ | routine | routine := MFTRoutine new. self assert: routine workouts isEmpty ] { #category : 'tests' } MFTRoutineTest >> testTitleAccessor [ | routine | routine := MFTRoutine new. routine title: 'Heavy Duty I'. self assert: routine title equals: 'Heavy Duty I' ] { #category : 'tests' } MFTRoutineTest >> testWorkoutAfterAnswersNilWhenRoutineHasNoWorkouts [ | routine | routine := MFTRoutine new. self assert: (routine workoutAfter: #unknown) isNil ] { #category : 'tests' } MFTRoutineTest >> testWorkoutAfterKnownWorkoutAnswersFollowingWorkout [ | routine | routine := MFTRoutine new. routine workouts: #( day1 day2 day3 ). self assert: (routine workoutAfter: #day1) equals: #day2. self assert: (routine workoutAfter: #day2) equals: #day3 ] { #category : 'tests' } MFTRoutineTest >> testWorkoutAfterLastWorkoutWrapsToFirstWorkout [ | routine | routine := MFTRoutine new. routine workouts: #( day1 day2 day3 ). self assert: (routine workoutAfter: #day3) equals: #day1 ] { #category : 'tests' } MFTRoutineTest >> testWorkoutAfterUnknownWorkoutAnswersFirstWorkout [ | routine | routine := MFTRoutine new. routine workouts: #( day1 day2 day3 ). self assert: (routine workoutAfter: #unknown) equals: #day1 ] { #category : 'tests' } MFTRoutineTest >> testWorkoutsSetterStoresAnArray [ | routine workouts | routine := MFTRoutine new. workouts := OrderedCollection with: #day1 with: #day2. routine workouts: workouts. self assert: routine workouts class equals: OrderedCollection. self assert: routine workouts equals: workouts ]