예제 #1
0
        public void Verify_MapToModel_AssignsTeamProperties()
        {
            // Arrange
            var mapper = new TeamMapper();
            var entity = TeamsMockingSetup.DoMockingSetupForTeam();
            // 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.TeamAliases?.Count, model.TeamAliases?.Count);
            Assert.Equal(entity.Object.TeamCharacterEnemies?.Count, model.TeamCharacterEnemies?.Count);
            Assert.Equal(entity.Object.TeamCharacterFriends?.Count, model.TeamCharacterFriends?.Count);
            Assert.Equal(entity.Object.TeamIssuesAppearedIn?.Count, model.TeamIssuesAppearedIn?.Count);
            Assert.Equal(entity.Object.TeamIssuesDisbandedIn?.Count, model.TeamIssuesDisbandedIn?.Count);
            Assert.Equal(entity.Object.TeamIssues?.Count, model.TeamIssues?.Count);
            Assert.Equal(entity.Object.TeamMembers?.Count, model.TeamMembers?.Count);
            Assert.Equal(entity.Object.TeamMovies?.Count, model.TeamMovies?.Count);
            Assert.Equal(entity.Object.TeamStoryArcs?.Count, model.TeamStoryArcs?.Count);
            Assert.Equal(entity.Object.TeamVolumes?.Count, model.TeamVolumes?.Count);
        }
예제 #2
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new TeamMapper();
            var model  = TeamsMockingSetup.DoMockingSetupForTeamModel(1);
            var entity = TeamsMockingSetup.DoMockingSetupForTeam(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
예제 #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <TeamMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <ITeam>(), It.IsAny <int>()));
            var mockEntity = TeamsMockingSetup.DoMockingSetupForTeam(1);

            TeamMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <ITeam>(), It.IsAny <int>()), Times.Once);
        }
예제 #4
0
        public void Verify_MapToModelLite_AssignsLiteOnlyTeamProperties()
        {
            // Arrange
            var mapper = new TeamMapper();
            var entity = TeamsMockingSetup.DoMockingSetupForTeam();
            // 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);
        }
예제 #5
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <TeamMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <ITeamModel>(), It.IsAny <ITeam>()));
            TeamMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = TeamsMockingSetup.DoMockingSetupForTeamModel(1);
            var mockEntity = TeamsMockingSetup.DoMockingSetupForTeam(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <ITeamModel>(), It.IsAny <ITeam>()), Times.Once);
        }