Ejemplo n.º 1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new TeamMemberMapper();
            var model  = TeamMembersMockingSetup.DoMockingSetupForTeamMemberModel(1);
            var entity = TeamMembersMockingSetup.DoMockingSetupForTeamMember(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

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

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ITeamMemberModel>(), It.IsAny <int>()));
            var mockModel = TeamMembersMockingSetup.DoMockingSetupForTeamMemberModel(1);

            TeamMemberMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ITeamMemberModel>(), It.IsAny <int>()), Times.Once);
        }
Ejemplo n.º 3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyTeamMemberProperties()
        {
            // Arrange
            var mapper = new TeamMemberMapper();
            var entity = TeamMembersMockingSetup.DoMockingSetupForTeamMember();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.TeamId, model.TeamId);
            Assert.Equal(entity.Object.CharacterId, model.CharacterId);
        }
Ejemplo n.º 4
0
        public void Verify_MapToEntity_AssignsTeamMemberProperties()
        {
            // Arrange
            var mapper = new TeamMemberMapper();
            var model  = TeamMembersMockingSetup.DoMockingSetupForTeamMemberModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.TeamId, entity.TeamId);
            Assert.Equal(model.Object.CharacterId, entity.CharacterId);
            // Associated Objects
            // <None>
        }
Ejemplo n.º 5
0
        public void Verify_MapToSearchModel_AssignsTeamMemberSearchProperties()
        {
            // Arrange
            var mapper = new TeamMemberMapper();
            var model  = TeamMembersMockingSetup.DoMockingSetupForTeamMemberModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.TeamId, searchModel.TeamId);
            Assert.Equal(model.Object.Team?.CustomKey, searchModel.TeamCustomKey);
            Assert.Equal(model.Object.Team?.ApiDetailUrl, searchModel.TeamApiDetailUrl);
            Assert.Equal(model.Object.Team?.SiteDetailUrl, searchModel.TeamSiteDetailUrl);
            Assert.Equal(model.Object.Team?.Name, searchModel.TeamName);
            Assert.Equal(model.Object.Team?.ShortDescription, searchModel.TeamShortDescription);
            Assert.Equal(model.Object.Team?.Description, searchModel.TeamDescription);
            Assert.Equal(model.Object.CharacterId, searchModel.CharacterId);
            Assert.Equal(model.Object.Character?.CustomKey, searchModel.CharacterCustomKey);
            Assert.Equal(model.Object.Character?.ApiDetailUrl, searchModel.CharacterApiDetailUrl);
            Assert.Equal(model.Object.Character?.SiteDetailUrl, searchModel.CharacterSiteDetailUrl);
            Assert.Equal(model.Object.Character?.Name, searchModel.CharacterName);
            Assert.Equal(model.Object.Character?.ShortDescription, searchModel.CharacterShortDescription);
            Assert.Equal(model.Object.Character?.Description, searchModel.CharacterDescription);
        }