コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new MovieLocationMapper();
            var model  = MovieLocationsMockingSetup.DoMockingSetupForMovieLocationModel(1);
            var entity = MovieLocationsMockingSetup.DoMockingSetupForMovieLocation(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <MovieLocationMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IMovieLocationModel>(), It.IsAny <int>()));
            var mockModel = MovieLocationsMockingSetup.DoMockingSetupForMovieLocationModel(1);

            MovieLocationMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IMovieLocationModel>(), It.IsAny <int>()), Times.Once);
        }
コード例 #3
0
        public void Verify_MapToEntity_AssignsMovieLocationProperties()
        {
            // Arrange
            var mapper = new MovieLocationMapper();
            var model  = MovieLocationsMockingSetup.DoMockingSetupForMovieLocationModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.MovieId, entity.MovieId);
            Assert.Equal(model.Object.LocationId, entity.LocationId);
            // Associated Objects
            // <None>
        }
コード例 #4
0
        public void Verify_MapToSearchModel_AssignsMovieLocationSearchProperties()
        {
            // Arrange
            var mapper = new MovieLocationMapper();
            var model  = MovieLocationsMockingSetup.DoMockingSetupForMovieLocationModel();
            // 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.LocationId, searchModel.LocationId);
            Assert.Equal(model.Object.Location?.CustomKey, searchModel.LocationCustomKey);
            Assert.Equal(model.Object.Location?.ApiDetailUrl, searchModel.LocationApiDetailUrl);
            Assert.Equal(model.Object.Location?.SiteDetailUrl, searchModel.LocationSiteDetailUrl);
            Assert.Equal(model.Object.Location?.Name, searchModel.LocationName);
            Assert.Equal(model.Object.Location?.ShortDescription, searchModel.LocationShortDescription);
            Assert.Equal(model.Object.Location?.Description, searchModel.LocationDescription);
        }