public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue() { // Arrange var mockCharacterEnemyTeamsRepository = CharacterEnemyTeamsMockingSetup.DoMockingSetupForRepository(); mockCharacterEnemyTeamsRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null); var businessWorkflow = new CharacterEnemyTeamsBusinessWorkflow(mockCharacterEnemyTeamsRepository.Object, new CharacterEnemyTeamMapper()); // Act var result = businessWorkflow.Remove("DOESNT-EXIST"); // Assert Assert.Equal(true, result); }
public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue() { // Arrange var mockCharacterEnemyTeamsRepository = CharacterEnemyTeamsMockingSetup.DoMockingSetupForRepository(); var mockCharacterEnemyTeamsMapper = new Mock <ICharacterEnemyTeamMapper>(); mockCharacterEnemyTeamsMapper.Setup(m => m.AreEqual(It.IsAny <ICharacterEnemyTeamModel>(), It.IsAny <ICharacterEnemyTeam>())).Returns(() => true); var businessWorkflow = new CharacterEnemyTeamsBusinessWorkflow(mockCharacterEnemyTeamsRepository.Object, mockCharacterEnemyTeamsMapper.Object); mockCharacterEnemyTeamsRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => new Mock <ICharacterEnemyTeam>().Object); mockCharacterEnemyTeamsRepository.Setup(m => m.SaveChanges()).Returns(() => true); // Act var result = businessWorkflow.Remove("KING-STEPHEN"); // Assert mockCharacterEnemyTeamsRepository.Verify(m => m.Remove(It.IsAny <ICharacterEnemyTeam>()), Times.Once); Assert.Equal(true, result); }
public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue() { // Arrange var mockCharacterEnemyTeamsRepository = CharacterEnemyTeamsMockingSetup.DoMockingSetupForRepository(); var mockCharacterEnemyTeamsMapper = new Mock<ICharacterEnemyTeamMapper>(); mockCharacterEnemyTeamsMapper.Setup(m => m.AreEqual(It.IsAny<ICharacterEnemyTeamModel>(), It.IsAny<ICharacterEnemyTeam>())).Returns(() => true); var businessWorkflow = new CharacterEnemyTeamsBusinessWorkflow(mockCharacterEnemyTeamsRepository.Object, mockCharacterEnemyTeamsMapper.Object); mockCharacterEnemyTeamsRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => new Mock<ICharacterEnemyTeam>().Object); mockCharacterEnemyTeamsRepository.Setup(m => m.SaveChanges()).Returns(() => true); // Act var result = businessWorkflow.Remove("KING-STEPHEN"); // Assert mockCharacterEnemyTeamsRepository.Verify(m => m.Remove(It.IsAny<ICharacterEnemyTeam>()), Times.Once); Assert.Equal(true, result); }
public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue() { // Arrange var mockCharacterEnemyTeamsRepository = CharacterEnemyTeamsMockingSetup.DoMockingSetupForRepository(); mockCharacterEnemyTeamsRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => null); var businessWorkflow = new CharacterEnemyTeamsBusinessWorkflow(mockCharacterEnemyTeamsRepository.Object, new CharacterEnemyTeamMapper()); // Act var result = businessWorkflow.Remove("DOESNT-EXIST"); // Assert Assert.Equal(true, result); }