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")); }
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")); }
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")); }