Пример #1
0
 public void Verify_MapToSearchModel_AssignsPowerSearchProperties()
 {
     // Arrange
     var mapper = new PowerMapper();
     var model  = PowersMockingSetup.DoMockingSetupForPowerModel();
     // Act
     var searchModel = mapper.MapToSearchModel(model.Object);
     // Assert
 }
Пример #2
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new PowerMapper();
            var model  = PowersMockingSetup.DoMockingSetupForPowerModel(1);
            var entity = PowersMockingSetup.DoMockingSetupForPower(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Пример #3
0
 public void Verify_MapToModelLite_AssignsLiteOnlyPowerProperties()
 {
     // Arrange
     var mapper = new PowerMapper();
     var entity = PowersMockingSetup.DoMockingSetupForPower();
     // Act
     var model = mapper.MapToModelLite(entity.Object);
     // Assert
     // <None>
     // Related Objects
     // <None>
 }
Пример #4
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <PowerMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IPowerModel>(), It.IsAny <int>()));
            var mockModel = PowersMockingSetup.DoMockingSetupForPowerModel(1);

            PowerMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IPowerModel>(), It.IsAny <int>()), Times.Once);
        }
Пример #5
0
        public void Verify_MapToModel_AssignsPowerProperties()
        {
            // Arrange
            var mapper = new PowerMapper();
            var entity = PowersMockingSetup.DoMockingSetupForPower();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            // <None>
            // Related Objects
            // <None>
            // Associated Objects
            Assert.Equal(entity.Object.CharacterPowers?.Count, model.CharacterPowers?.Count);
            Assert.Equal(entity.Object.PowerAliases?.Count, model.PowerAliases?.Count);
        }
Пример #6
0
        public void Verify_MapToEntity_AssignsPowerProperties()
        {
            // Arrange
            var mapper = new PowerMapper();
            var model  = PowersMockingSetup.DoMockingSetupForPowerModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            // <None>
            // Associated Objects
            //Assert.Equal(model.Object.CharacterPowers?.Count, entity.CharacterPowers?.Count);
            model.VerifyGet(x => x.CharacterPowers, Times.Once);
            //Assert.Equal(model.Object.PowerAliases?.Count, entity.PowerAliases?.Count);
            model.VerifyGet(x => x.PowerAliases, Times.Once);
        }