Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <MovieStudioMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IMovieStudioModel>(), It.IsAny <int>()));
            var mockModel = MovieStudiosMockingSetup.DoMockingSetupForMovieStudioModel(1);

            MovieStudioMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IMovieStudioModel>(), It.IsAny <int>()), Times.Once);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void Verify_MapToEntity_AssignsMovieStudioProperties()
        {
            // Arrange
            var mapper = new MovieStudioMapper();
            var model  = MovieStudiosMockingSetup.DoMockingSetupForMovieStudioModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.MovieId, entity.MovieId);
            Assert.Equal(model.Object.StudioId, entity.StudioId);
            // Associated Objects
            // <None>
        }
Exemplo n.º 5
0
        public void Verify_MapToSearchModel_AssignsMovieStudioSearchProperties()
        {
            // Arrange
            var mapper = new MovieStudioMapper();
            var model  = MovieStudiosMockingSetup.DoMockingSetupForMovieStudioModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.MovieId, searchModel.MovieId);
            Assert.Equal(model.Object.Movie?.CustomKey, searchModel.MovieCustomKey);
            Assert.Equal(model.Object.Movie?.ApiDetailUrl, searchModel.MovieApiDetailUrl);
            Assert.Equal(model.Object.Movie?.SiteDetailUrl, searchModel.MovieSiteDetailUrl);
            Assert.Equal(model.Object.Movie?.Name, searchModel.MovieName);
            Assert.Equal(model.Object.Movie?.ShortDescription, searchModel.MovieShortDescription);
            Assert.Equal(model.Object.Movie?.Description, searchModel.MovieDescription);
            Assert.Equal(model.Object.StudioId, searchModel.StudioId);
            Assert.Equal(model.Object.Studio?.CustomKey, searchModel.StudioCustomKey);
            Assert.Equal(model.Object.Studio?.ApiDetailUrl, searchModel.StudioApiDetailUrl);
            Assert.Equal(model.Object.Studio?.SiteDetailUrl, searchModel.StudioSiteDetailUrl);
            Assert.Equal(model.Object.Studio?.Name, searchModel.StudioName);
            Assert.Equal(model.Object.Studio?.ShortDescription, searchModel.StudioShortDescription);
            Assert.Equal(model.Object.Studio?.Description, searchModel.StudioDescription);
        }