public void ExtractPropertyValue()
        {
            PropertyInfoValueExtractor pe;

            pe = new PropertyInfoValueExtractor(pi);
            var test = new ClassTest1();

            test.Property = "StringTest";
            Assert.AreEqual("StringTest", pe.ExtractValue(test), "FieldExtractor Does not extract property values");
        }
        public void ExtractFieldValue()
        {
            FieldInfoValueExtractor fe;

            fe = new FieldInfoValueExtractor(fi);
            var test = new ClassTest1();

            test.field = 34;
            Assert.AreEqual(34, fe.ExtractValue(test), "FieldExtractor Does not extract field values");
        }
        public void ExtractFieldByProperty()
        {
            NamedValueExtractor nve;

            nve = new NamedValueExtractor("Property");
            var test = new ClassTest1();

            test.Property = "StringTest";
            Assert.AreEqual(test.Property, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get Property");
        }
        public void NamedValueExtractorWithInvalidField()
        {
            NamedValueExtractor nve;

            nve = new NamedValueExtractor("xxx");
            var test = new ClassTest1();

            test.field = 30;
            Assert.Throws(typeof(ArgumentException), () => nve.ExtractValue(test));
        }
        public void ExtractFieldByName()
        {
            NamedValueExtractor nve;

            nve = new NamedValueExtractor("field");
            var test = new ClassTest1();

            test.field = 30;
            Assert.AreEqual(test.field, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get field");
        }
 public void ExtractByBinaryOperatorSubtract()
 {
     IValueExtractor ve = new BinaryOperatorValueExtractor(
         new NamedValueExtractor("field"),
         new NamedValueExtractor("otherfield"),
         BinaryOperatorValueExtractor.MathOperation.Subtraction);
     var obj = new ClassTest1();
     obj.field = 10;
     obj.otherfield = 34;
     Assert.AreEqual(-24, ve.ExtractValue(obj), "Binary Extractor does not work.");
 }
        public void ExtractByBinaryOperatorDivision()
        {
            IValueExtractor ve = new BinaryOperatorValueExtractor(
                new NamedValueExtractor("field"),
                new NamedValueExtractor("otherfield"),
                BinaryOperatorValueExtractor.MathOperation.Division);
            var obj = new ClassTest1();

            obj.field      = 10;
            obj.otherfield = 2;
            Assert.AreEqual(5, ve.ExtractValue(obj), "Binary Extractor does not work.");
        }
        public void ExtractByBinaryOperatorUnknownOperator()
        {
            IValueExtractor ve = new BinaryOperatorValueExtractor(
                new NamedValueExtractor("field"),
                new NamedValueExtractor("otherfield"),
                (BinaryOperatorValueExtractor.MathOperation) 10000);
            var obj = new ClassTest1();

            obj.field      = 10;
            obj.otherfield = 34;
            ve.ExtractValue(obj);
        }
 public void ExtractFieldByName()
 {
     NamedValueExtractor nve;
     nve = new NamedValueExtractor("field");
     var test = new ClassTest1();
     test.field = 30;
     Assert.AreEqual(test.field, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get field");
 }
 public void ExtractByBinaryOperatorUnknownOperator()
 {
     IValueExtractor ve = new BinaryOperatorValueExtractor(
         new NamedValueExtractor("field"),
         new NamedValueExtractor("otherfield"),
         (BinaryOperatorValueExtractor.MathOperation) 10000);
     var obj = new ClassTest1();
     obj.field = 10;
     obj.otherfield = 34;
     ve.ExtractValue(obj);
 }
 public void NamedValueExtractorWithInvalidField()
 {
     NamedValueExtractor nve;
     nve = new NamedValueExtractor("xxx");
     var test = new ClassTest1();
     test.field = 30;
     Assert.Throws(typeof (ArgumentException), () => nve.ExtractValue(test));
 }
 public void ExtractPropertyValue()
 {
     PropertyInfoValueExtractor pe;
     pe = new PropertyInfoValueExtractor(pi);
     var test = new ClassTest1();
     test.Property = "StringTest";
     Assert.AreEqual("StringTest", pe.ExtractValue(test), "FieldExtractor Does not extract property values");
 }
 public void ExtractFieldValue()
 {
     FieldInfoValueExtractor fe;
     fe = new FieldInfoValueExtractor(fi);
     var test = new ClassTest1();
     test.field = 34;
     Assert.AreEqual(34, fe.ExtractValue(test), "FieldExtractor Does not extract field values");
 }
 public void ExtractFieldByProperty()
 {
     NamedValueExtractor nve;
     nve = new NamedValueExtractor("Property");
     var test = new ClassTest1();
     test.Property = "StringTest";
     Assert.AreEqual(test.Property, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get Property");
 }