Example #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>());
        }
Example #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);
        }
Example #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>());
        }
Example #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);
        }
Example #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);
        }