コード例 #1
0
        public void CanReflectChangeInUnderlyingData()
        {
            var structure = new StructureTest.TestStructure();
            var strongBox = new StrongBox <BooleanValue>(false);

            structure.TestAddInstanceSuffix("FOO", new Suffix <BooleanValue>(BuildBasicGetter(strongBox)));

            strongBox.Value = false;
            Assert.IsFalse((BooleanValue)structure.GetSuffix("FOO").Value);
            strongBox.Value = true;
            Assert.IsTrue((BooleanValue)structure.GetSuffix("FOO").Value);
        }
コード例 #2
0
        public void CanSetSuffix()
        {
            const int TEST_VALUE = 12345;
            var       structure  = new StructureTest.TestStructure();
            var       strongBox  = new StrongBox <ScalarIntValue>(TEST_VALUE);

            structure.TestAddInstanceSuffix("FOO", new SetSuffix <ScalarIntValue>(BuildBasicGetter(strongBox), BuildBasicSetter(strongBox)));
            structure.TestAddInstanceSuffix("BAR", new SetSuffix <ScalarIntValue>(BuildBasicGetter(strongBox), BuildBasicSetter(strongBox)));

            Assert.AreEqual(ScalarValue.Create(TEST_VALUE), structure.GetSuffix("FOO").Value);
            structure.SetSuffix("FOO", TEST_VALUE - 10);
            Assert.AreEqual(ScalarValue.Create(TEST_VALUE - 10), structure.GetSuffix("FOO").Value);
            structure.SetSuffix("FOO", TEST_VALUE / 20);
            Assert.AreEqual(ScalarValue.Create(TEST_VALUE / 20), structure.GetSuffix("FOO").Value);
        }
コード例 #3
0
        public void CanSetSuffix()
        {
            const int TEST_VALUE = 12345;
            var       structure  = new StructureTest.TestStructure();
            var       strongBox  = new StrongBox <int>(TEST_VALUE);

            structure.TestAddInstanceSuffix("FOO", new SetSuffix <int>(BuildBasicGetter(strongBox), BuildBasicSetter(strongBox)));
            structure.TestAddInstanceSuffix("BAR", new SetSuffix <int>(BuildBasicGetter(strongBox), BuildBasicSetter(strongBox)));

            Assert.AreEqual(TEST_VALUE, structure.GetSuffix("FOO"));
            structure.SetSuffix("FOO", TEST_VALUE - 10);
            Assert.AreEqual(TEST_VALUE - 10, structure.GetSuffix("FOO"));
            structure.SetSuffix("FOO", TEST_VALUE / 20);
            Assert.AreEqual(TEST_VALUE / 20, structure.GetSuffix("FOO"));
        }
コード例 #4
0
        public void CanAddSuffix()
        {
            var structure = new StructureTest.TestStructure();
            var strongBox = new StrongBox <BooleanValue>(false);

            structure.TestAddInstanceSuffix("FOO", new Suffix <BooleanValue>(BuildBasicGetter(strongBox)));
            Assert.IsFalse((BooleanValue)structure.GetSuffix("FOO").Value);
        }
コード例 #5
0
        public void CanAddSetSuffix()
        {
            var structure = new StructureTest.TestStructure();
            var strongBox = new StrongBox <bool>(false);

            structure.TestAddInstanceSuffix("FOO", new SetSuffix <bool>(BuildBasicGetter(strongBox), BuildBasicSetter(strongBox)));

            Assert.IsFalse((bool)structure.GetSuffix("FOO"));
        }