public void CreateFutureSetAndGetValue() { Future future = new Future(); future.SetValue(1); object result = future.GetValue(); Assert.IsNotNull(result); Assert.AreEqual(1, result); result = future.GetValue(); Assert.IsNotNull(result); Assert.AreEqual(1, result); }
private int[] MergeItems(Tuple t, Future sortedGreater, Future sortedLess) { List<int> result = new List<int>(); result.AddRange(sortedLess.GetValue<int[]>()); result.AddRange(t.Eq); result.AddRange(sortedGreater.GetValue<int[]>()); return result.ToArray(); }
private int[] MergeItems(Tuple t, Future sortedGreater, Future sortedLess) { List <int> result = new List <int>(); result.AddRange(sortedLess.GetValue <int[]>()); result.AddRange(t.Eq); result.AddRange(sortedGreater.GetValue <int[]>()); return(result.ToArray()); }
public void CreateFutureGetAndSetValue() { Future future = new Future(); ManualResetEvent handle = new ManualResetEvent(false); bool executed = false; Thread thread = new Thread(new ThreadStart(() => { handle.WaitOne(); executed = true; future.SetValue(1); })); thread.Start(); Assert.IsFalse(executed); Thread.Sleep(100); Assert.IsFalse(executed); handle.Set(); object result = future.GetValue(); Assert.IsTrue(executed); Assert.IsNotNull(result); Assert.AreEqual(1, result); }