Ejemplo n.º 1
0
        public void CanReflectChangeInUnderlyingData()
        {
            var structure = new StructureTest.TestStructure();
            var strongBox = new StrongBox <bool>(false);

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

            strongBox.Value = false;
            Assert.IsFalse((bool)structure.GetSuffix("FOO"));
            strongBox.Value = true;
            Assert.IsTrue((bool)structure.GetSuffix("FOO"));
        }
Ejemplo n.º 2
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"));
        }
Ejemplo n.º 3
0
        public void CanAddSuffix()
        {
            var structure = new StructureTest.TestStructure();
            var strongBox = new StrongBox <bool>(false);

            structure.TestAddInstanceSuffix("FOO", new Suffix <bool>(BuildBasicGetter(strongBox)));
            Assert.IsFalse((bool)structure.GetSuffix("FOO"));
        }