" A MFTSetGroupLogTest is a test class for testing the behavior of MFTSetGroupLog " Class { #name : 'MFTSetGroupLogTest', #superclass : 'TestCase', #category : 'MyFitnessTracker-Core-Tests-Logging', #package : 'MyFitnessTracker-Core-Tests', #tag : 'Logging' } { #category : 'tests' } MFTSetGroupLogTest >> testAddSetAppendsSetLog [ | groupLog firstSet secondSet | groupLog := MFTSetGroupLog new. firstSet := MFTSetLog new. secondSet := MFTSetLog new. groupLog addSet: firstSet. groupLog addSet: secondSet. self assert: groupLog sets asArray equals: { firstSet. secondSet } ] { #category : 'tests' } MFTSetGroupLogTest >> testEmptyGroupLogIsCompletelyLogged [ | groupLog | groupLog := MFTSetGroupLog new. self assert: groupLog isCompletelyLogged ] { #category : 'tests' } MFTSetGroupLogTest >> testGroupLogIsCompletelyLoggedWhenAllSetsAreLogged [ | groupLog | groupLog := MFTSetGroupLog new. groupLog sets: { (MFTSetLog reps: 6 load: 100). (MFTSetLog reps: 5 load: 110) }. self assert: groupLog isCompletelyLogged ] { #category : 'tests' } MFTSetGroupLogTest >> testGroupLogIsNotCompletelyLoggedWhenAnySetIsUnlogged [ | groupLog | groupLog := MFTSetGroupLog new. groupLog sets: { (MFTSetLog reps: 6 load: 100). MFTSetLog new }. self deny: groupLog isCompletelyLogged ] { #category : 'tests' } MFTSetGroupLogTest >> testNewGroupLogStartsWithEmptySetsAndNotes [ | groupLog | groupLog := MFTSetGroupLog new. self assert: groupLog sets isEmpty. self assert: groupLog notes equals: String new ] { #category : 'tests' } MFTSetGroupLogTest >> testNotesCanBeRecorded [ | groupLog | groupLog := MFTSetGroupLog new. groupLog notes: 'Felt strong, but recovery still incomplete.'. self assert: groupLog notes equals: 'Felt strong, but recovery still incomplete.' ] { #category : 'tests' } MFTSetGroupLogTest >> testPrescriptionCanBeRecorded [ | groupLog prescription | groupLog := MFTSetGroupLog new. prescription := Object new. groupLog prescription: prescription. self assert: groupLog prescription identicalTo: prescription ] { #category : 'tests' } MFTSetGroupLogTest >> testSetLogForPrescriptionRaisesErrorWhenPrescriptionIsUnknown [ | groupLog knownPrescription unknownPrescription knownLog | groupLog := MFTSetGroupLog new. knownPrescription := Object new. unknownPrescription := Object new. knownLog := MFTSetLog forPrescription: knownPrescription. groupLog addSet: knownLog. self should: [ groupLog setLogForPrescription: unknownPrescription ] raise: Error ] { #category : 'tests' } MFTSetGroupLogTest >> testSetLogForPrescriptionReturnsMatchingSetLogByIdentity [ | groupLog firstPrescription secondPrescription firstLog secondLog | groupLog := MFTSetGroupLog new. firstPrescription := Object new. secondPrescription := Object new. firstLog := MFTSetLog forPrescription: firstPrescription. secondLog := MFTSetLog forPrescription: secondPrescription. groupLog sets: { firstLog. secondLog }. self assert: (groupLog setLogForPrescription: secondPrescription) identicalTo: secondLog ]