Exemplo n.º 1
0
        public void Verify_MapToSearchModel_AssignsStoryArcSearchProperties()
        {
            // Arrange
            var mapper = new StoryArcMapper();
            var model  = StoryArcsMockingSetup.DoMockingSetupForStoryArcModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.PrimaryImageFileId, searchModel.PrimaryImageFileId);
            Assert.Equal(model.Object.PrimaryImageFile?.CustomKey, searchModel.PrimaryImageFileCustomKey);
            Assert.Equal(model.Object.PrimaryImageFile?.ApiDetailUrl, searchModel.PrimaryImageFileApiDetailUrl);
            Assert.Equal(model.Object.PrimaryImageFile?.SiteDetailUrl, searchModel.PrimaryImageFileSiteDetailUrl);
            Assert.Equal(model.Object.PrimaryImageFile?.Name, searchModel.PrimaryImageFileName);
            Assert.Equal(model.Object.PrimaryImageFile?.ShortDescription, searchModel.PrimaryImageFileShortDescription);
            Assert.Equal(model.Object.PrimaryImageFile?.Description, searchModel.PrimaryImageFileDescription);
            Assert.Equal(model.Object.FirstIssueAppearanceId, searchModel.FirstIssueAppearanceId);
            Assert.Equal(model.Object.FirstIssueAppearance?.CustomKey, searchModel.FirstIssueAppearanceCustomKey);
            Assert.Equal(model.Object.FirstIssueAppearance?.ApiDetailUrl, searchModel.FirstIssueAppearanceApiDetailUrl);
            Assert.Equal(model.Object.FirstIssueAppearance?.SiteDetailUrl, searchModel.FirstIssueAppearanceSiteDetailUrl);
            Assert.Equal(model.Object.FirstIssueAppearance?.Name, searchModel.FirstIssueAppearanceName);
            Assert.Equal(model.Object.FirstIssueAppearance?.ShortDescription, searchModel.FirstIssueAppearanceShortDescription);
            Assert.Equal(model.Object.FirstIssueAppearance?.Description, searchModel.FirstIssueAppearanceDescription);
            Assert.Equal(model.Object.PublisherId, searchModel.PublisherId);
            Assert.Equal(model.Object.Publisher?.CustomKey, searchModel.PublisherCustomKey);
            Assert.Equal(model.Object.Publisher?.ApiDetailUrl, searchModel.PublisherApiDetailUrl);
            Assert.Equal(model.Object.Publisher?.SiteDetailUrl, searchModel.PublisherSiteDetailUrl);
            Assert.Equal(model.Object.Publisher?.Name, searchModel.PublisherName);
            Assert.Equal(model.Object.Publisher?.ShortDescription, searchModel.PublisherShortDescription);
            Assert.Equal(model.Object.Publisher?.Description, searchModel.PublisherDescription);
        }
Exemplo n.º 2
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsStoryArcProperties()
        {
            // Arrange
            var mapper = new StoryArcMapper();
            var model  = StoryArcsMockingSetup.DoMockingSetupForStoryArcModel();
            // Act
            IStoryArc existingEntity = new StoryArc {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.PrimaryImageFileId, existingEntity.PrimaryImageFileId);
            Assert.Equal(model.Object.FirstIssueAppearanceId, existingEntity.FirstIssueAppearanceId);
            Assert.Equal(model.Object.PublisherId, existingEntity.PublisherId);
            // Associated Objects
            model.VerifyGet(x => x.MovieStoryArcs, Times.Once);
            //Assert.Equal(model.Object.MovieStoryArcs?.Count, existingEntity.MovieStoryArcs?.Count);
            model.VerifyGet(x => x.StoryArcAliases, Times.Once);
            //Assert.Equal(model.Object.StoryArcAliases?.Count, existingEntity.StoryArcAliases?.Count);
            model.VerifyGet(x => x.StoryArcIssues, Times.Once);
            //Assert.Equal(model.Object.StoryArcIssues?.Count, existingEntity.StoryArcIssues?.Count);
            model.VerifyGet(x => x.StoryArcsWritten, Times.Once);
            //Assert.Equal(model.Object.StoryArcsWritten?.Count, existingEntity.StoryArcsWritten?.Count);
        }
Exemplo n.º 3
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new StoryArcMapper();
            var model  = StoryArcsMockingSetup.DoMockingSetupForStoryArcModel(1);
            var entity = StoryArcsMockingSetup.DoMockingSetupForStoryArc(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 4
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <StoryArcMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IStoryArcModel>(), It.IsAny <int>()));
            var mockModel = StoryArcsMockingSetup.DoMockingSetupForStoryArcModel(1);

            StoryArcMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IStoryArcModel>(), It.IsAny <int>()), Times.Once);
        }
Exemplo n.º 5
0
        public void Verify_MapToModelLite_AssignsLiteOnlyStoryArcProperties()
        {
            // Arrange
            var mapper = new StoryArcMapper();
            var entity = StoryArcsMockingSetup.DoMockingSetupForStoryArc();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
            Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId);
            Assert.Equal(entity.Object.PublisherId, model.PublisherId);
        }
Exemplo n.º 6
0
        public void Verify_MapToModel_AssignsStoryArcProperties()
        {
            // Arrange
            var mapper = new StoryArcMapper();
            var entity = StoryArcsMockingSetup.DoMockingSetupForStoryArc();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
            Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId);
            Assert.Equal(entity.Object.PublisherId, model.PublisherId);
            // Associated Objects
            Assert.Equal(entity.Object.MovieStoryArcs?.Count, model.MovieStoryArcs?.Count);
            Assert.Equal(entity.Object.StoryArcAliases?.Count, model.StoryArcAliases?.Count);
            Assert.Equal(entity.Object.StoryArcIssues?.Count, model.StoryArcIssues?.Count);
            Assert.Equal(entity.Object.StoryArcsWritten?.Count, model.StoryArcsWritten?.Count);
        }