public void TestDoWhenPropStringChangedBefore() { // TODO: AAA mod1 = new OnlyTypedAccessModel(PropBagTypeSafetyMode.OnlyTypedAccess, _amHelpers.StoreAccessCreator, _amHelpers.PropFactory_V1, "PropBagLib.Tests.OnlyTypedAccessModel"); mod1.PropStringChanged += Mod1_PropStringChanged; string temp = mod1.PropString; Assert.That(temp, Is.Null, "Expecting the initial value of PropString to be null."); propStringOldVal = "u"; propStringNewVal = "x"; mod1.DoWhenStringChanged_WasCalled = false; mod1.DoWhenStringPropOldVal = "y"; mod1.DoWhenStringPropNewVal = "z"; mod1.PropString = "Water Colors"; temp = mod1.PropString; Assert.That(temp, Is.EqualTo("Water Colors"), "Expecting the value of PropString to be updated to 'Water Colors.'"); Assert.That(propString_WasUpdated, Is.True, "Expecting propStringWasUpdated to be true."); Assert.That(propStringOldVal, Is.Null, "Expecting the value of propStringOldVal to be null."); Assert.That(propStringNewVal, Is.EqualTo("Water Colors"), "Expecting the value of propStringNewVal to be 'Water Colors.'"); Assert.That(doWhenStringChanged_WasCalled, Is.True, "Expecting internal DoWWhenPropStringChanged to be called before the public event."); Assert.That(mod1.DoWhenStringPropOldVal, Is.Null, "Expecting the value of propStringOldVal to be null."); Assert.That(mod1.DoWhenStringPropNewVal, Is.EqualTo("Water Colors"), "Expecting the value of propStringNewVal to be 'Water Colors.'"); Assert.That(mod1.DoWhenStringChanged_WasCalled, Is.True, "Expecting internal DoWhenPropStringChanged not to have been called."); }
public void TestAddNewProp() { // TODO: AAA mod1 = new OnlyTypedAccessModel(PropBagTypeSafetyMode.Tight, _amHelpers.StoreAccessCreator, _amHelpers.PropFactory_V1, "PropBagLib.Tests.OnlyTypedAccessModel"); //mod1["System.String", "NewProperty"] = "This is a a test."; InvalidOperationException aa = new InvalidOperationException(); Type tt = aa.GetType(); Assert.Throws(tt, () => mod1["System.String", "NewProperty"] = "This is a a test."); }
public void TestAllRegSetBool() { // TODO: AAA mod1 = new OnlyTypedAccessModel(PropBagTypeSafetyMode.OnlyTypedAccess, _amHelpers.StoreAccessCreator, _amHelpers.PropFactory_V1, "PropBagLib.Tests.OnlyTypedAccessModel"); bool temp = mod1.PropBool; Assert.That(temp, Is.EqualTo(false), "Expecting the initial value of PropBool to be false."); mod1.PropBool = true; temp = mod1.PropBool; Assert.That(temp, Is.EqualTo(true), "Expecting the value of PropBool to be updated to true."); }
public void TestDoWhenPropStringChangedAfter() { // TODO: AAA mod1 = new OnlyTypedAccessModel(PropBagTypeSafetyMode.OnlyTypedAccess, _amHelpers.StoreAccessCreator, _amHelpers.PropFactory_V1, "PropBagLib.Tests.OnlyTypedAccessModel"); mod1.PropStringCallDoAfterChanged += Mod1_PropStringChanged; // TODO: Need to add test to check that values are really set to undefined. mod1.PropStringCallDoAfter = null; string temp = mod1.PropStringCallDoAfter; Assert.That(temp, Is.Null, "Expecting the initial value of PropString to be null."); propStringOldVal = "u"; propStringNewVal = "x"; mod1.DoWhenStringChanged_WasCalled = false; mod1.DoWhenStringPropOldVal = "y"; mod1.DoWhenStringPropNewVal = "z"; mod1.PropStringCallDoAfter = "Water Colors"; temp = mod1.PropStringCallDoAfter; Assert.That(temp, Is.EqualTo("Water Colors"), "Expecting the value of PropString to be updated to 'Water Colors.'"); Assert.That(propString_WasUpdated, Is.True, "Expecting propStringWasUpdated to be true."); Assert.That(propStringOldVal, Is.Null, "Expecting the value of propStringOldVal to be null."); Assert.That(propStringNewVal, Is.EqualTo("Water Colors"), "Expecting the value of propStringNewVal to be 'Water Colors.'"); // TODO: Fix This: The Order in which these are called in not yet suported. //Assert.That(doWhenStringChanged_WasCalled, Is.False, "Expecting internal DoWWhenPropStringChanged to not be called before the public event."); Assert.That(mod1.DoWhenStringPropOldVal, Is.Null, "Expecting the value of propStringOldVal to be null."); Assert.That(mod1.DoWhenStringPropNewVal, Is.EqualTo("Water Colors"), "Expecting the value of propStringNewVal to be 'Water Colors.'"); Assert.That(mod1.DoWhenStringChanged_WasCalled, Is.True, "Expecting internal DoWhenPropStringChanged not to have been called."); }
public void Destroy() { mod1 = null; }