コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new MovieProducerMapper();
            var model  = MovieProducersMockingSetup.DoMockingSetupForMovieProducerModel(1);
            var entity = MovieProducersMockingSetup.DoMockingSetupForMovieProducer(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyMovieProducerProperties()
        {
            // Arrange
            var mapper = new MovieProducerMapper();
            var entity = MovieProducersMockingSetup.DoMockingSetupForMovieProducer();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.MovieId, model.MovieId);
            Assert.Equal(entity.Object.ProducerId, model.ProducerId);
        }
コード例 #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <MovieProducerMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IMovieProducer>(), It.IsAny <int>()));
            var mockEntity = MovieProducersMockingSetup.DoMockingSetupForMovieProducer(1);

            MovieProducerMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IMovieProducer>(), It.IsAny <int>()), Times.Once);
        }
コード例 #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <MovieProducerMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IMovieProducerModel>(), It.IsAny <IMovieProducer>()));
            MovieProducerMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = MovieProducersMockingSetup.DoMockingSetupForMovieProducerModel(1);
            var mockEntity = MovieProducersMockingSetup.DoMockingSetupForMovieProducer(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IMovieProducerModel>(), It.IsAny <IMovieProducer>()), Times.Once);
        }