Пример #1
0
        public void Apply_NoProperty_Exception()
        {
            IGeneric original = new Generic1();
            IGeneric style    = new Generic2()
            {
                OneHasProperty = "test"
            };

            Assert.That(() => _propertyApplier.Apply(original, style),
                        Throws.TypeOf <ArgumentException>());
        }
Пример #2
0
        public void Apply_GenericObjectPrototyped()
        {
            var propertyValue = "test";
            var original      = new Generic1();
            var style         = new Generic1()
            {
                Property = propertyValue
            };

            _propertyApplier.Apply(original, style);

            original.Property.Should().Be(style.Property);
        }
Пример #3
0
        public void Apply_PropertyDifferentType_Exception()
        {
            IGeneric original = new Generic1()
            {
                TypeCheck = "test"
            };
            IGeneric style = new Generic2()
            {
                TypeCheck = 2
            };

            Assert.That(() => _propertyApplier.Apply(original, style),
                        Throws.TypeOf <ArgumentException>());
        }
Пример #4
0
        public void Apply_BoolPropertySetToDefaultValue_OriginalBoolSet()
        {
            IGeneric original = new Generic1()
            {
                BoolVal = true
            };
            var style = new Generic1()
            {
                BoolVal = false
            };

            _propertyApplier.Apply(original, style);

            original.BoolVal.Should().Be(false);
        }
Пример #5
0
        public void Apply_PropertyIsDefault_NoChange()
        {
            var      propertyValue = "test";
            IGeneric original      = new Generic1()
            {
                Property = propertyValue
            };
            var style = new Generic1();

            style.SetHasPropertyChanged(false);

            _propertyApplier.Apply(original, style);

            original.Property.Should().Be(propertyValue);
        }