コード例 #1
0
        public void ConfigAttributeApplyToExtendedClass()
        {
            var conf = NFX.Environment.XMLConfiguration.CreateFromXML(xml);

            var cl = new MyClassExtended();

            ConfigAttribute.Apply(cl, conf.Root);

            Assert.AreEqual("private", cl.getPrivateName());
            Assert.AreEqual("protected", cl.getProtectedName());
            Assert.AreEqual("public", cl.m_PublicName);


            Assert.AreEqual(-892, cl.getPrivateInt());
            Assert.AreEqual(23567, cl.getPrivateProperty());

            Assert.AreEqual(+892, cl.getPrivateIntExtended());
            Assert.AreEqual(-23567, cl.getPrivatePropertyExtended());


            Assert.AreEqual(99, cl.Age);
            Assert.AreEqual(MyEnum.B, cl.MyEnumField);

            Assert.AreEqual(5, cl.When.Month);
            Assert.AreEqual(12, cl.When.Day);
            Assert.AreEqual(1982, cl.When.Year);

            Assert.AreEqual(true, cl.Fuzzy.Value);

            Assert.AreEqual(false, cl.Jazzy.HasValue);

            Assert.AreEqual(155, cl.NoneInt);
            Assert.AreEqual(true, cl.NoneBool);
            Assert.AreEqual("This is default", cl.NoneString);
            Assert.AreEqual("So what?", cl.NoneAnotherString);
        }
コード例 #2
0
ファイル: Attributes.cs プロジェクト: vlapchenko/nfx
        public void ConfigAttributeApplyToExtendedClass()
        {
          var conf = NFX.Environment.XMLConfiguration.CreateFromXML(xml);

          var cl = new MyClassExtended();
          ConfigAttribute.Apply(cl, conf.Root);

          Assert.AreEqual("private", cl.getPrivateName());
          Assert.AreEqual("protected", cl.getProtectedName());
          Assert.AreEqual("public", cl.m_PublicName);


          Assert.AreEqual(-892, cl.getPrivateInt());
          Assert.AreEqual(23567, cl.getPrivateProperty());

          Assert.AreEqual(+892, cl.getPrivateIntExtended());
          Assert.AreEqual(-23567, cl.getPrivatePropertyExtended());


          Assert.AreEqual(99, cl.Age);
          Assert.AreEqual(MyEnum.B, cl.MyEnumField);

          Assert.AreEqual(5, cl.When.Month);
          Assert.AreEqual(12, cl.When.Day);
          Assert.AreEqual(1982, cl.When.Year);

          Assert.AreEqual(true, cl.Fuzzy.Value);

          Assert.AreEqual(false, cl.Jazzy.HasValue);

           Assert.AreEqual(155, cl.NoneInt);
           Assert.AreEqual(true, cl.NoneBool);
           Assert.AreEqual("This is default", cl.NoneString);
           Assert.AreEqual("So what?", cl.NoneAnotherString);

        }