public void TestDispatchUntypedTask() { var service = new AsyncTestService(); var deferred = service.UnTypedTaskResult(); var result = 0; deferred.Promise().Then((value) => { Assert(value); result = 1; }, (err) => { Debug.LogError(err); Unreachable(); }) .Dispatch(); Assert(result == 0); service.ForValueOne.Resolve(100); Assert(result == 0); service.ForValueTwo.Resolve(100); Assert(result == 0); PromiseWorker.Get().Update(); Assert(result == 1); }
public void TestDispatch() { var service = new AsyncTestService(); var deferred = service.ResolveValue(); var result = 0; deferred.Then((value) => { result = value; }); Assert(result == 0); service.ForValueOne.Resolve(100); Assert(result == 0); service.ForValueTwo.Resolve(100); Assert(result == 0); PromiseWorker.Get().Update(); Assert(result == 200); }