public void Verify_Deactivate_ByID_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
 {
     // Arrange
     var mockEpisodeCharactersDiedRepository = EpisodeCharactersDiedMockingSetup.DoMockingSetupForRepository();
     mockEpisodeCharactersDiedRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => null);
     var mockEpisodeCharactersDiedMapper = new Mock<IEpisodeCharacterDiedMapper>();
     mockEpisodeCharactersDiedMapper.Setup(m => m.AreEqual(It.IsAny<IEpisodeCharacterDiedModel>(), It.IsAny<IEpisodeCharacterDied>())).Returns(() => true);
     var businessWorkflow = new EpisodeCharactersDiedBusinessWorkflow(mockEpisodeCharactersDiedRepository.Object, mockEpisodeCharactersDiedMapper.Object);
     // Act/Assert
     Assert.Throws<System.InvalidOperationException>(() => businessWorkflow.Deactivate(1));
 }
        public void Verify_Deactivate_ByKey_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
        {
            // Arrange
            var mockEpisodeCharactersDiedRepository = EpisodeCharactersDiedMockingSetup.DoMockingSetupForRepository();

            mockEpisodeCharactersDiedRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null);
            var mockEpisodeCharactersDiedMapper = new Mock <IEpisodeCharacterDiedMapper>();

            mockEpisodeCharactersDiedMapper.Setup(m => m.AreEqual(It.IsAny <IEpisodeCharacterDiedModel>(), It.IsAny <IEpisodeCharacterDied>())).Returns(() => true);
            var businessWorkflow = new EpisodeCharactersDiedBusinessWorkflow(mockEpisodeCharactersDiedRepository.Object, mockEpisodeCharactersDiedMapper.Object);

            // Act/Assert
            Assert.Throws <System.InvalidOperationException>(() => businessWorkflow.Deactivate("TEST"));
        }
        public void Verify_Deactivate_ByKey_Should_DeactivateTheObjectAndReturnTrue()
        {
            // Arrange
            var mockEpisodeCharactersDiedRepository = EpisodeCharactersDiedMockingSetup.DoMockingSetupForRepository();
            var mockEpisodeCharactersDiedMapper     = new Mock <IEpisodeCharacterDiedMapper>();

            mockEpisodeCharactersDiedMapper.Setup(m => m.AreEqual(It.IsAny <IEpisodeCharacterDiedModel>(), It.IsAny <IEpisodeCharacterDied>())).Returns(() => true);
            var businessWorkflow = new EpisodeCharactersDiedBusinessWorkflow(mockEpisodeCharactersDiedRepository.Object, mockEpisodeCharactersDiedMapper.Object);

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

            // Assert
            mockEpisodeCharactersDiedRepository.Verify(m => m.Deactivate(It.IsAny <IEpisodeCharacterDied>()), Times.Once);
            Assert.Equal(true, result);
        }
 public void Verify_Deactivate_ByID_Should_DeactivateTheObjectAndReturnTrue()
 {
     // Arrange
     var mockEpisodeCharactersDiedRepository = EpisodeCharactersDiedMockingSetup.DoMockingSetupForRepository();
     var mockEpisodeCharactersDiedMapper = new Mock<IEpisodeCharacterDiedMapper>();
     mockEpisodeCharactersDiedMapper.Setup(m => m.AreEqual(It.IsAny<IEpisodeCharacterDiedModel>(), It.IsAny<IEpisodeCharacterDied>())).Returns(() => true);
     var businessWorkflow = new EpisodeCharactersDiedBusinessWorkflow(mockEpisodeCharactersDiedRepository.Object, mockEpisodeCharactersDiedMapper.Object);
     mockEpisodeCharactersDiedRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => new Mock<IEpisodeCharacterDied>().Object);
     mockEpisodeCharactersDiedRepository.Setup(m => m.SaveChanges()).Returns(() => true);
     // Act
     var result = businessWorkflow.Deactivate(1);
     // Assert
     mockEpisodeCharactersDiedRepository.Verify(m => m.Deactivate(It.IsAny<IEpisodeCharacterDied>()), Times.Once);
     Assert.Equal(true, result);
 }