public void CallAimDataMethodAddAim_WithCorrectAim() { // Arrange var mockedAim = new Mock <Aim>(); var mockedData = new Mock <IDearDiaryData>(); mockedData.Setup(x => x.Aims.Add(mockedAim.Object)).Verifiable(); AimService service = new AimService(mockedData.Object); // Act service.AddAim(mockedAim.Object); // Assert mockedData.Verify(x => x.Aims.Add(mockedAim.Object), Times.Once); }
public void CallDataAimsAddMethod() { // Arrange var mockedAim = new Mock <Aim>(); var mockedData = new Mock <IDearDiaryData>(); mockedData.Setup(x => x.Aims.Add(It.IsAny <Aim>())).Verifiable(); AimService service = new AimService(mockedData.Object); // Act service.AddAim(mockedAim.Object); // Assert mockedData.Verify(x => x.Aims.Add(It.IsAny <Aim>()), Times.Once); }