public void MultipleDoneTest(int callbackCount) { //arrange bool[] done = new bool[callbackCount]; for (int i = 0; i < done.Length; i++) { int index = i; _task.Done(() => done[index] = true); } //act _task.Resolve(); //assert Assert.True(done.All(x => x)); }
public void SetValueTest() { //arrange var testTask = new PandaTask <int>(); int callbackResult = 0; testTask.Done(x => callbackResult = x); bool rejected = false; testTask.Fail(x => rejected = true); //act const int testValue = 32; testTask.SetValue(testValue); //assert Assert.False(rejected); Assert.Null(testTask.Error); Assert.AreEqual(testValue, callbackResult); Assert.AreEqual(testValue, testTask.Result); Assert.AreEqual(PandaTaskStatus.Resolved, testTask.Status); }