Exemple #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);
        }
Exemple #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyCharacterPowerProperties()
        {
            // Arrange
            var mapper = new CharacterPowerMapper();
            var entity = CharacterPowersMockingSetup.DoMockingSetupForCharacterPower();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.CharacterId, model.CharacterId);
            Assert.Equal(entity.Object.PowerId, model.PowerId);
        }
Exemple #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <CharacterPowerMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <ICharacterPower>(), It.IsAny <int>()));
            var mockEntity = CharacterPowersMockingSetup.DoMockingSetupForCharacterPower(1);

            CharacterPowerMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <ICharacterPower>(), It.IsAny <int>()), Times.Once);
        }
Exemple #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <CharacterPowerMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <ICharacterPowerModel>(), It.IsAny <ICharacterPower>()));
            CharacterPowerMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = CharacterPowersMockingSetup.DoMockingSetupForCharacterPowerModel(1);
            var mockEntity = CharacterPowersMockingSetup.DoMockingSetupForCharacterPower(1);

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