Exemplo n.º 1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new CharacterPowerMapper();
            var model  = CharacterPowersMockingSetup.DoMockingSetupForCharacterPowerModel(1);
            var entity = CharacterPowersMockingSetup.DoMockingSetupForCharacterPower(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

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

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ICharacterPowerModel>(), It.IsAny <int>()));
            var mockModel = CharacterPowersMockingSetup.DoMockingSetupForCharacterPowerModel(1);

            CharacterPowerMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ICharacterPowerModel>(), It.IsAny <int>()), Times.Once);
        }
Exemplo n.º 3
0
        public void Verify_MapToEntity_AssignsCharacterPowerProperties()
        {
            // Arrange
            var mapper = new CharacterPowerMapper();
            var model  = CharacterPowersMockingSetup.DoMockingSetupForCharacterPowerModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.CharacterId, entity.CharacterId);
            Assert.Equal(model.Object.PowerId, entity.PowerId);
            // Associated Objects
            // <None>
        }
Exemplo n.º 4
0
        public void Verify_MapToSearchModel_AssignsCharacterPowerSearchProperties()
        {
            // Arrange
            var mapper = new CharacterPowerMapper();
            var model  = CharacterPowersMockingSetup.DoMockingSetupForCharacterPowerModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            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);
            Assert.Equal(model.Object.PowerId, searchModel.PowerId);
            Assert.Equal(model.Object.Power?.CustomKey, searchModel.PowerCustomKey);
            Assert.Equal(model.Object.Power?.ApiDetailUrl, searchModel.PowerApiDetailUrl);
            Assert.Equal(model.Object.Power?.SiteDetailUrl, searchModel.PowerSiteDetailUrl);
            Assert.Equal(model.Object.Power?.Name, searchModel.PowerName);
            Assert.Equal(model.Object.Power?.ShortDescription, searchModel.PowerShortDescription);
            Assert.Equal(model.Object.Power?.Description, searchModel.PowerDescription);
        }