Exemple #1
0
        public void AttachedPropertyTest()
        {
            Siyova16 _dataSource = new Siyova16(); //Create an instance of any class

            Assert.ThrowsException <ArgumentNullException>(() => new AttachedProperty <double>(null, "Rewoca75"), "The exception must be thrown if dataSource is null");
            Assert.ThrowsException <ArgumentException>(() => new AttachedProperty <string>(_dataSource, "Rewoca75"), "The exception must be thrown if properties types don't match");
            Assert.ThrowsException <ArgumentException>(() => new AttachedProperty <double>(_dataSource, "Rewoca75" + "A"), "The exception must be thrown if property name is wrong");
            AttachedProperty <double> _newProperty = new AttachedProperty <double>(_dataSource, "Rewoca75");

            _dataSource.Rewoca75 = 123456789.987;
            Assert.AreEqual <double>(123456789.987, _newProperty.Value);
            _newProperty.Value = 987654321.123;
            Assert.AreEqual <double>((double)987654321.123, _dataSource.Rewoca75);
        }
Exemple #2
0
            internal static object CreateObject(CreationHints hints)
            {
                object _return = null;

                switch (hints)
                {
                case CreationHints.Suxuxe12:
                    _return = new AttributedClass();
                    break;

                case CreationHints.Gipoci82:
                    _return = new Siyova16();
                    break;
                }
                return(_return);
            }