Ejemplo n.º 1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new SeriesMapper();
            var model  = SeriesMockingSetup.DoMockingSetupForSeriesModel(1);
            var entity = SeriesMockingSetup.DoMockingSetupForSeries(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 2
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <SeriesMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <ISeries>(), It.IsAny <int>()));
            var mockEntity = SeriesMockingSetup.DoMockingSetupForSeries(1);

            SeriesMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <ISeries>(), It.IsAny <int>()), Times.Once);
        }
Ejemplo n.º 3
0
        public void Verify_MapToModelLite_AssignsLiteOnlySeriesProperties()
        {
            // Arrange
            var mapper = new SeriesMapper();
            var entity = SeriesMockingSetup.DoMockingSetupForSeries();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            Assert.Equal(entity.Object.Startyear, model.Startyear);
            // Related Objects
            Assert.Equal(entity.Object.PublisherId, model.PublisherId);
            Assert.Equal(entity.Object.FirstEpisodeId, model.FirstEpisodeId);
            Assert.Equal(entity.Object.LastEpisodeId, model.LastEpisodeId);
        }
Ejemplo n.º 4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <SeriesMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <ISeriesModel>(), It.IsAny <ISeries>()));
            SeriesMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = SeriesMockingSetup.DoMockingSetupForSeriesModel(1);
            var mockEntity = SeriesMockingSetup.DoMockingSetupForSeries(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <ISeriesModel>(), It.IsAny <ISeries>()), Times.Once);
        }
Ejemplo n.º 5
0
        public void Verify_MapToModel_AssignsSeriesProperties()
        {
            // Arrange
            var mapper = new SeriesMapper();
            var entity = SeriesMockingSetup.DoMockingSetupForSeries();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            Assert.Equal(entity.Object.Startyear, model.Startyear);
            // Related Objects
            Assert.Equal(entity.Object.PublisherId, model.PublisherId);
            Assert.Equal(entity.Object.FirstEpisodeId, model.FirstEpisodeId);
            Assert.Equal(entity.Object.LastEpisodeId, model.LastEpisodeId);
            // Associated Objects
            Assert.Equal(entity.Object.Episodes?.Count, model.Episodes?.Count);
            Assert.Equal(entity.Object.SeriesAliases?.Count, model.SeriesAliases?.Count);
            Assert.Equal(entity.Object.SeriesCharacters?.Count, model.SeriesCharacters?.Count);
            Assert.Equal(entity.Object.SeriesLocations?.Count, model.SeriesLocations?.Count);
        }