public void Verify_MapToModel_AssignsMovieProperties()
        {
            // Arrange
            var mapper = new MovieMapper();
            var entity = MoviesMockingSetup.DoMockingSetupForMovie();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            Assert.Equal(entity.Object.HasStaffReview, model.HasStaffReview);
            Assert.Equal(entity.Object.Distributor, model.Distributor);
            Assert.Equal(entity.Object.BoxOfficeRevenue, model.BoxOfficeRevenue);
            Assert.Equal(entity.Object.TotalRevenue, model.TotalRevenue);
            Assert.Equal(entity.Object.Budget, model.Budget);
            Assert.Equal(entity.Object.Rating, model.Rating);
            Assert.Equal(entity.Object.ReleaseDate, model.ReleaseDate);
            Assert.Equal(entity.Object.RunTime, model.RunTime);
            // Related Objects
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
            // Associated Objects
            Assert.Equal(entity.Object.MovieCharacters?.Count, model.MovieCharacters?.Count);
            Assert.Equal(entity.Object.MovieConcepts?.Count, model.MovieConcepts?.Count);
            Assert.Equal(entity.Object.MovieLocations?.Count, model.MovieLocations?.Count);
            Assert.Equal(entity.Object.MovieObjects?.Count, model.MovieObjects?.Count);
            Assert.Equal(entity.Object.MovieProducers?.Count, model.MovieProducers?.Count);
            Assert.Equal(entity.Object.MovieStoryArcs?.Count, model.MovieStoryArcs?.Count);
            Assert.Equal(entity.Object.MovieStudios?.Count, model.MovieStudios?.Count);
            Assert.Equal(entity.Object.MovieTeams?.Count, model.MovieTeams?.Count);
            Assert.Equal(entity.Object.MovieWriters?.Count, model.MovieWriters?.Count);
        }
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new MovieMapper();
            var model  = MoviesMockingSetup.DoMockingSetupForMovieModel(1);
            var entity = MoviesMockingSetup.DoMockingSetupForMovie(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <MovieMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IMovie>(), It.IsAny <int>()));
            var mockEntity = MoviesMockingSetup.DoMockingSetupForMovie(1);

            MovieMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IMovie>(), It.IsAny <int>()), Times.Once);
        }
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <MovieMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IMovieModel>(), It.IsAny <IMovie>()));
            MovieMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = MoviesMockingSetup.DoMockingSetupForMovieModel(1);
            var mockEntity = MoviesMockingSetup.DoMockingSetupForMovie(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IMovieModel>(), It.IsAny <IMovie>()), Times.Once);
        }
        public void Verify_MapToModelLite_AssignsLiteOnlyMovieProperties()
        {
            // Arrange
            var mapper = new MovieMapper();
            var entity = MoviesMockingSetup.DoMockingSetupForMovie();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            Assert.Equal(entity.Object.HasStaffReview, model.HasStaffReview);
            Assert.Equal(entity.Object.Distributor, model.Distributor);
            Assert.Equal(entity.Object.BoxOfficeRevenue, model.BoxOfficeRevenue);
            Assert.Equal(entity.Object.TotalRevenue, model.TotalRevenue);
            Assert.Equal(entity.Object.Budget, model.Budget);
            Assert.Equal(entity.Object.Rating, model.Rating);
            Assert.Equal(entity.Object.ReleaseDate, model.ReleaseDate);
            Assert.Equal(entity.Object.RunTime, model.RunTime);
            // Related Objects
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
        }