public void Verify_Deactivate_ByID_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
 {
     // Arrange
     var mockLocationMoviesRepository = LocationMoviesMockingSetup.DoMockingSetupForRepository();
     mockLocationMoviesRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => null);
     var mockLocationMoviesMapper = new Mock<ILocationMovieMapper>();
     mockLocationMoviesMapper.Setup(m => m.AreEqual(It.IsAny<ILocationMovieModel>(), It.IsAny<ILocationMovie>())).Returns(() => true);
     var businessWorkflow = new LocationMoviesBusinessWorkflow(mockLocationMoviesRepository.Object, mockLocationMoviesMapper.Object);
     // Act/Assert
     Assert.Throws<System.InvalidOperationException>(() => businessWorkflow.Deactivate(1));
 }
        public void Verify_Deactivate_ByKey_ANonExistingEntity_Should_ThrowAnInvalidOperationException()
        {
            // Arrange
            var mockLocationMoviesRepository = LocationMoviesMockingSetup.DoMockingSetupForRepository();

            mockLocationMoviesRepository.Setup(m => m.Get(It.IsAny <string>())).Returns(() => null);
            var mockLocationMoviesMapper = new Mock <ILocationMovieMapper>();

            mockLocationMoviesMapper.Setup(m => m.AreEqual(It.IsAny <ILocationMovieModel>(), It.IsAny <ILocationMovie>())).Returns(() => true);
            var businessWorkflow = new LocationMoviesBusinessWorkflow(mockLocationMoviesRepository.Object, mockLocationMoviesMapper.Object);

            // Act/Assert
            Assert.Throws <System.InvalidOperationException>(() => businessWorkflow.Deactivate("TEST"));
        }
        public void Verify_Deactivate_ByKey_Should_DeactivateTheObjectAndReturnTrue()
        {
            // Arrange
            var mockLocationMoviesRepository = LocationMoviesMockingSetup.DoMockingSetupForRepository();
            var mockLocationMoviesMapper     = new Mock <ILocationMovieMapper>();

            mockLocationMoviesMapper.Setup(m => m.AreEqual(It.IsAny <ILocationMovieModel>(), It.IsAny <ILocationMovie>())).Returns(() => true);
            var businessWorkflow = new LocationMoviesBusinessWorkflow(mockLocationMoviesRepository.Object, mockLocationMoviesMapper.Object);

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

            // Assert
            mockLocationMoviesRepository.Verify(m => m.Deactivate(It.IsAny <ILocationMovie>()), Times.Once);
            Assert.Equal(true, result);
        }
 public void Verify_Deactivate_ByID_Should_DeactivateTheObjectAndReturnTrue()
 {
     // Arrange
     var mockLocationMoviesRepository = LocationMoviesMockingSetup.DoMockingSetupForRepository();
     var mockLocationMoviesMapper = new Mock<ILocationMovieMapper>();
     mockLocationMoviesMapper.Setup(m => m.AreEqual(It.IsAny<ILocationMovieModel>(), It.IsAny<ILocationMovie>())).Returns(() => true);
     var businessWorkflow = new LocationMoviesBusinessWorkflow(mockLocationMoviesRepository.Object, mockLocationMoviesMapper.Object);
     mockLocationMoviesRepository.Setup(m => m.Get(It.IsAny<int>())).Returns(() => new Mock<ILocationMovie>().Object);
     mockLocationMoviesRepository.Setup(m => m.SaveChanges()).Returns(() => true);
     // Act
     var result = businessWorkflow.Deactivate(1);
     // Assert
     mockLocationMoviesRepository.Verify(m => m.Deactivate(It.IsAny<ILocationMovie>()), Times.Once);
     Assert.Equal(true, result);
 }