public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue()
        {
            // Arrange
            var mockGendersRepository = GendersMockingSetup.DoMockingSetupForRepository();

            mockGendersRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null);
            var businessWorkflow = new GendersBusinessWorkflow(mockGendersRepository.Object, new GenderMapper());
            // Act
            var result = businessWorkflow.Remove("DOESNT-EXIST");

            // Assert
            Assert.Equal(true, result);
        }
        public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue()
        {
            // Arrange
            var mockGendersRepository = GendersMockingSetup.DoMockingSetupForRepository();
            var mockGendersMapper     = new Mock <IGenderMapper>();

            mockGendersMapper.Setup(m => m.AreEqual(It.IsAny <IGenderModel>(), It.IsAny <IGender>())).Returns(() => true);
            var businessWorkflow = new GendersBusinessWorkflow(mockGendersRepository.Object, mockGendersMapper.Object);

            mockGendersRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => new Mock <IGender>().Object);
            mockGendersRepository.Setup(m => m.SaveChanges()).Returns(() => true);
            // Act
            var result = businessWorkflow.Remove("KING-STEPHEN");

            // Assert
            mockGendersRepository.Verify(m => m.Remove(It.IsAny <IGender>()), Times.Once);
            Assert.Equal(true, result);
        }
 public void Verify_Remove_ByKey_Should_DeactivateTheObjectAndReturnTrue()
 {
     // Arrange
     var mockGendersRepository = GendersMockingSetup.DoMockingSetupForRepository();
     var mockGendersMapper = new Mock<IGenderMapper>();
     mockGendersMapper.Setup(m => m.AreEqual(It.IsAny<IGenderModel>(), It.IsAny<IGender>())).Returns(() => true);
     var businessWorkflow = new GendersBusinessWorkflow(mockGendersRepository.Object, mockGendersMapper.Object);
     mockGendersRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => new Mock<IGender>().Object);
     mockGendersRepository.Setup(m => m.SaveChanges()).Returns(() => true);
     // Act
     var result = businessWorkflow.Remove("KING-STEPHEN");
     // Assert
     mockGendersRepository.Verify(m => m.Remove(It.IsAny<IGender>()), Times.Once);
     Assert.Equal(true, result);
 }
 public void Verify_Remove_ANonExistingEntity_Should_ReturnTrue()
 {
     // Arrange
     var mockGendersRepository = GendersMockingSetup.DoMockingSetupForRepository();
     mockGendersRepository.Setup(m => m.Get(It.IsAny<string>())).Returns(() => null);
     var businessWorkflow = new GendersBusinessWorkflow(mockGendersRepository.Object, new GenderMapper());
     // Act
     var result = businessWorkflow.Remove("DOESNT-EXIST");
     // Assert
     Assert.Equal(true, result);
 }