コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new SeriesAliasMapper();
            var model  = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAliasModel(1);
            var entity = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAlias(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlySeriesAliasProperties()
        {
            // Arrange
            var mapper = new SeriesAliasMapper();
            var entity = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAlias();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.SeriesId, model.SeriesId);
        }
コード例 #3
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <SeriesAliasMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ISeriesAliasModel>(), It.IsAny <int>()));
            var mockModel = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAliasModel(1);

            SeriesAliasMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ISeriesAliasModel>(), It.IsAny <int>()), Times.Once);
        }
コード例 #4
0
        public void Verify_MapToEntity_AssignsSeriesAliasProperties()
        {
            // Arrange
            var mapper = new SeriesAliasMapper();
            var model  = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAliasModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.SeriesId, entity.SeriesId);
            // Associated Objects
            // <None>
        }
コード例 #5
0
        public void Verify_MapToSearchModel_AssignsSeriesAliasSearchProperties()
        {
            // Arrange
            var mapper = new SeriesAliasMapper();
            var model  = SeriesAliasesMockingSetup.DoMockingSetupForSeriesAliasModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.SeriesId, searchModel.SeriesId);
            Assert.Equal(model.Object.Series?.CustomKey, searchModel.SeriesCustomKey);
            Assert.Equal(model.Object.Series?.ApiDetailUrl, searchModel.SeriesApiDetailUrl);
            Assert.Equal(model.Object.Series?.SiteDetailUrl, searchModel.SeriesSiteDetailUrl);
            Assert.Equal(model.Object.Series?.Name, searchModel.SeriesName);
            Assert.Equal(model.Object.Series?.ShortDescription, searchModel.SeriesShortDescription);
            Assert.Equal(model.Object.Series?.Description, searchModel.SeriesDescription);
        }