public void Verify_Deactivate_ByID_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
 {
     // Arrange
     var mockMovieConceptsRepository = MovieConceptsMockingSetup.DoMockingSetupForRepository();
     mockMovieConceptsRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => null);
     var mockMovieConceptsMapper = new Mock<IMovieConceptMapper>();
     mockMovieConceptsMapper.Setup(m => m.AreEqual(It.IsAny<IMovieConceptModel>(), It.IsAny<IMovieConcept>())).Returns(() => true);
     var businessWorkflow = new MovieConceptsBusinessWorkflow(mockMovieConceptsRepository.Object, mockMovieConceptsMapper.Object);
     // Act/Assert
     Assert.Throws<System.InvalidOperationException>(() => businessWorkflow.Deactivate(1));
 }
        public void Verify_Deactivate_ByKey_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
        {
            // Arrange
            var mockMovieConceptsRepository = MovieConceptsMockingSetup.DoMockingSetupForRepository();

            mockMovieConceptsRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null);
            var mockMovieConceptsMapper = new Mock <IMovieConceptMapper>();

            mockMovieConceptsMapper.Setup(m => m.AreEqual(It.IsAny <IMovieConceptModel>(), It.IsAny <IMovieConcept>())).Returns(() => true);
            var businessWorkflow = new MovieConceptsBusinessWorkflow(mockMovieConceptsRepository.Object, mockMovieConceptsMapper.Object);

            // Act/Assert
            Assert.Throws <System.InvalidOperationException>(() => businessWorkflow.Deactivate("TEST"));
        }
        public void Verify_Deactivate_ByKey_Should_DeactivateTheObjectAndReturnTrue()
        {
            // Arrange
            var mockMovieConceptsRepository = MovieConceptsMockingSetup.DoMockingSetupForRepository();
            var mockMovieConceptsMapper     = new Mock <IMovieConceptMapper>();

            mockMovieConceptsMapper.Setup(m => m.AreEqual(It.IsAny <IMovieConceptModel>(), It.IsAny <IMovieConcept>())).Returns(() => true);
            var businessWorkflow = new MovieConceptsBusinessWorkflow(mockMovieConceptsRepository.Object, mockMovieConceptsMapper.Object);

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

            // Assert
            mockMovieConceptsRepository.Verify(m => m.Deactivate(It.IsAny <IMovieConcept>()), Times.Once);
            Assert.Equal(true, result);
        }
 public void Verify_Deactivate_ByID_Should_DeactivateTheObjectAndReturnTrue()
 {
     // Arrange
     var mockMovieConceptsRepository = MovieConceptsMockingSetup.DoMockingSetupForRepository();
     var mockMovieConceptsMapper = new Mock<IMovieConceptMapper>();
     mockMovieConceptsMapper.Setup(m => m.AreEqual(It.IsAny<IMovieConceptModel>(), It.IsAny<IMovieConcept>())).Returns(() => true);
     var businessWorkflow = new MovieConceptsBusinessWorkflow(mockMovieConceptsRepository.Object, mockMovieConceptsMapper.Object);
     mockMovieConceptsRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => new Mock<IMovieConcept>().Object);
     mockMovieConceptsRepository.Setup(m => m.SaveChanges()).Returns(() => true);
     // Act
     var result = businessWorkflow.Deactivate(1);
     // Assert
     mockMovieConceptsRepository.Verify(m => m.Deactivate(It.IsAny<IMovieConcept>()), Times.Once);
     Assert.Equal(true, result);
 }