Пример #1
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);
        }
Пример #2
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <StoryArcMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IStoryArc>(), It.IsAny <int>()));
            var mockEntity = StoryArcsMockingSetup.DoMockingSetupForStoryArc(1);

            StoryArcMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IStoryArc>(), It.IsAny <int>()), Times.Once);
        }
Пример #3
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);
        }
Пример #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <StoryArcMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IStoryArcModel>(), It.IsAny <IStoryArc>()));
            StoryArcMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = StoryArcsMockingSetup.DoMockingSetupForStoryArcModel(1);
            var mockEntity = StoryArcsMockingSetup.DoMockingSetupForStoryArc(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IStoryArcModel>(), It.IsAny <IStoryArc>()), Times.Once);
        }
Пример #5
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);
        }