Exemple #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new MovieStudioMapper();
            var model  = MovieStudiosMockingSetup.DoMockingSetupForMovieStudioModel(1);
            var entity = MovieStudiosMockingSetup.DoMockingSetupForMovieStudio(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Exemple #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyMovieStudioProperties()
        {
            // Arrange
            var mapper = new MovieStudioMapper();
            var entity = MovieStudiosMockingSetup.DoMockingSetupForMovieStudio();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.MovieId, model.MovieId);
            Assert.Equal(entity.Object.StudioId, model.StudioId);
        }
Exemple #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <MovieStudioMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IMovieStudio>(), It.IsAny <int>()));
            var mockEntity = MovieStudiosMockingSetup.DoMockingSetupForMovieStudio(1);

            MovieStudioMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IMovieStudio>(), It.IsAny <int>()), Times.Once);
        }
Exemple #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <MovieStudioMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IMovieStudioModel>(), It.IsAny <IMovieStudio>()));
            MovieStudioMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = MovieStudiosMockingSetup.DoMockingSetupForMovieStudioModel(1);
            var mockEntity = MovieStudiosMockingSetup.DoMockingSetupForMovieStudio(1);

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