public async Task CompleteScope() { var result = await ScopeTaskMoq.Define(sc => sc.Yield(nameof(CompleteScope))) .StartAsync(); Assert.AreEqual(nameof(CompleteScope), result); }
public async Task CompleteWithObservationScope() { _console.Reset(); var observer = new FunctionObserver <object>(s => Console.WriteLine(s)); var result = await ScopeTaskMoq.Define(sc => { for (var i = 0; i < 3; i++) { sc.Yield(nameof(CompleteWithObservationScope) + i); } }) .Observe(ob => ob.Subscribe(observer)) .StartAsync(); Assert.AreEqual(nameof(CompleteWithObservationScope) + 2, result); Assert.AreEqual(3, _console.Lines.Count); }