public void RunPropertyChangedTest() { string code = @"import (Foo from ""ProtoTest.dll""); foo = Foo.GetInstance(); id = foo.ID; t = 1; " ; runner.PreStart(code, runconfig); Foo fooSingleton = Foo.GetInstance(); fooSingleton.ID = 101; DebugRunner.VMState vms = runner.StepOver(); vms = runner.StepOver(); vms = runner.StepOver(); Obj val = GetWatchValue(core, @"id"); Assert.IsTrue((Int64)val.Payload == 101); // As Foo implements INotifyPropertyChanged interface, the property // change notification should be propagated back to DS virtual // machine so that all DS objects that depend on that property // should be updated. fooSingleton.ID = 202; // So it is expected to reexecute "id = foo.ID", that is line 3. vms = runner.StepOver(); Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo); // Expect 'id' has been updated to 202 vms = runner.StepOver(); val = GetWatchValue(core, @"id"); Assert.IsTrue((Int64)val.Payload == 202); }
public void RunPropertyChangedForSameObjectTest() { string code = @"import (Foo from ""ProtoTest.dll""); foo = Foo.GetInstance(); bar = foo; id1 = foo.ID; id2 = bar.ID; t = 1; "; runner_.PreStart(code, runconfig_); Foo fooSingleton = Foo.GetInstance(); fooSingleton.ID = 101; DebugRunner.VMState vms; vms = runner_.StepOver(); // import ... vms = runner_.StepOver(); // foo = Foo.GetInstance(); vms = runner_.StepOver(); // bar = foo; vms = runner_.StepOver(); // id1 = foo.ID; vms = runner_.StepOver(); // id2 = bar.ID; Obj val; val = GetWatchValue(core_, @"id1"); Assert.IsTrue((Int64)val.Payload == 101); val = GetWatchValue(core_, @"id2"); Assert.IsTrue((Int64)val.Payload == 101); fooSingleton.ID = 202; // expect to re-execute id1 = foo.ID vms = runner_.StepOver(); Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo); vms = runner_.StepOver(); vms = runner_.StepOver(); val = GetWatchValue(core_, @"id1"); Assert.IsTrue((Int64)val.Payload == 202); // expect to re-execute id2 = bar.ID Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo); vms = runner_.StepOver(); val = GetWatchValue(core_, @"id2"); Assert.IsTrue((Int64)val.Payload == 202); }
public void RunPropertyChangedInOtherScopeTest() { string code = @"import (Foo from ""ProtoTest.dll""); def ding() { return = null; } foo = Foo.GetInstance(); id = foo.ID; r = ding(); t = 1; "; runner_.PreStart(code, runconfig_); Foo fooSingleton = Foo.GetInstance(); fooSingleton.ID = 101; DebugRunner.VMState vms; vms = runner_.StepOver(); vms = runner_.StepOver(); // foo = Foo.GetInstance(); vms = runner_.StepOver(); // id = foo.ID; Obj val = GetWatchValue(core_, @"id"); Assert.IsTrue((Int64)val.Payload == 101); vms = runner_.Step(); // return = null; fooSingleton.ID = 202; vms = runner_.Step(); // } vms = runner_.Step(); // expect to re-execute id = foo.ID vms = runner_.StepOver(); Assert.AreEqual(7, vms.ExecutionCursor.StartInclusive.LineNo); // Expect 'id' has been updated to 202 vms = runner_.StepOver(); val = GetWatchValue(core_, @"id"); Assert.IsTrue((Int64)val.Payload == 202); }