Example #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new CharacterMovieMapper();
            var model  = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovieModel(1);
            var entity = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovie(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Example #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <CharacterMovieMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ICharacterMovieModel>(), It.IsAny <int>()));
            var mockModel = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovieModel(1);

            CharacterMovieMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ICharacterMovieModel>(), It.IsAny <int>()), Times.Once);
        }
Example #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyCharacterMovieProperties()
        {
            // Arrange
            var mapper = new CharacterMovieMapper();
            var entity = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovie();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.CharacterId, model.CharacterId);
            Assert.Equal(entity.Object.MovieId, model.MovieId);
        }
Example #4
0
        public void Verify_MapToEntity_AssignsCharacterMovieProperties()
        {
            // Arrange
            var mapper = new CharacterMovieMapper();
            var model  = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovieModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.CharacterId, entity.CharacterId);
            Assert.Equal(model.Object.MovieId, entity.MovieId);
            // Associated Objects
            // <None>
        }
Example #5
0
        public void Verify_MapToSearchModel_AssignsCharacterMovieSearchProperties()
        {
            // Arrange
            var mapper = new CharacterMovieMapper();
            var model  = CharacterMoviesMockingSetup.DoMockingSetupForCharacterMovieModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.CharacterId, searchModel.CharacterId);
            Assert.Equal(model.Object.Character?.CustomKey, searchModel.CharacterCustomKey);
            Assert.Equal(model.Object.Character?.ApiDetailUrl, searchModel.CharacterApiDetailUrl);
            Assert.Equal(model.Object.Character?.SiteDetailUrl, searchModel.CharacterSiteDetailUrl);
            Assert.Equal(model.Object.Character?.Name, searchModel.CharacterName);
            Assert.Equal(model.Object.Character?.ShortDescription, searchModel.CharacterShortDescription);
            Assert.Equal(model.Object.Character?.Description, searchModel.CharacterDescription);
            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);
        }