public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue() { // Arrange var mockEpisodeTeamFirstAppearancesRepository = EpisodeTeamFirstAppearancesMockingSetup.DoMockingSetupForRepository(); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null); var businessWorkflow = new EpisodeTeamFirstAppearancesBusinessWorkflow(mockEpisodeTeamFirstAppearancesRepository.Object, new EpisodeTeamFirstAppearanceMapper()); // Act var result = businessWorkflow.Remove("DOESNT-EXIST"); // Assert Assert.Equal(true, result); }
public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue() { // Arrange var mockEpisodeTeamFirstAppearancesRepository = EpisodeTeamFirstAppearancesMockingSetup.DoMockingSetupForRepository(); var mockEpisodeTeamFirstAppearancesMapper = new Mock <IEpisodeTeamFirstAppearanceMapper>(); mockEpisodeTeamFirstAppearancesMapper.Setup(m => m.AreEqual(It.IsAny <IEpisodeTeamFirstAppearanceModel>(), It.IsAny <IEpisodeTeamFirstAppearance>())).Returns(() => true); var businessWorkflow = new EpisodeTeamFirstAppearancesBusinessWorkflow(mockEpisodeTeamFirstAppearancesRepository.Object, mockEpisodeTeamFirstAppearancesMapper.Object); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => new Mock <IEpisodeTeamFirstAppearance>().Object); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.SaveChanges()).Returns(() => true); // Act var result = businessWorkflow.Remove("KING-STEPHEN"); // Assert mockEpisodeTeamFirstAppearancesRepository.Verify(m => m.Remove(It.IsAny <IEpisodeTeamFirstAppearance>()), Times.Once); Assert.Equal(true, result); }
public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue() { // Arrange var mockEpisodeTeamFirstAppearancesRepository = EpisodeTeamFirstAppearancesMockingSetup.DoMockingSetupForRepository(); var mockEpisodeTeamFirstAppearancesMapper = new Mock<IEpisodeTeamFirstAppearanceMapper>(); mockEpisodeTeamFirstAppearancesMapper.Setup(m => m.AreEqual(It.IsAny<IEpisodeTeamFirstAppearanceModel>(), It.IsAny<IEpisodeTeamFirstAppearance>())).Returns(() => true); var businessWorkflow = new EpisodeTeamFirstAppearancesBusinessWorkflow(mockEpisodeTeamFirstAppearancesRepository.Object, mockEpisodeTeamFirstAppearancesMapper.Object); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => new Mock<IEpisodeTeamFirstAppearance>().Object); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.SaveChanges()).Returns(() => true); // Act var result = businessWorkflow.Remove("KING-STEPHEN"); // Assert mockEpisodeTeamFirstAppearancesRepository.Verify(m => m.Remove(It.IsAny<IEpisodeTeamFirstAppearance>()), Times.Once); Assert.Equal(true, result); }
public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue() { // Arrange var mockEpisodeTeamFirstAppearancesRepository = EpisodeTeamFirstAppearancesMockingSetup.DoMockingSetupForRepository(); mockEpisodeTeamFirstAppearancesRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => null); var businessWorkflow = new EpisodeTeamFirstAppearancesBusinessWorkflow(mockEpisodeTeamFirstAppearancesRepository.Object, new EpisodeTeamFirstAppearanceMapper()); // Act var result = businessWorkflow.Remove("DOESNT-EXIST"); // Assert Assert.Equal(true, result); }