public void CallReadyIndividualTokens() { var called = false; var abortCalled = false; var instance = new TestClass(); var watcher = new WatchedValue <TestClass>(); watcher .Ready() .OnSuccess(value => { called = true; }); watcher .Ready() .OnSuccess(value => { abortCalled = true; }) .Abort(); watcher.Value = instance; Assert.IsTrue(called); Assert.IsFalse(abortCalled); }
public void CallReadyError() { var called = false; var watcher = new WatchedValue <TestClass>(); watcher .Ready() .OnFailure(_ => called = true); watcher.Fail(new Exception()); Assert.IsTrue(called); }
public void CallReadyConstructor() { var called = false; var instance = new TestClass(); var watcher = new WatchedValue <TestClass>(); watcher.Value = instance; watcher .Ready() .OnSuccess(value => { called = true; Assert.AreSame(instance, value); }); Assert.IsTrue(called); }