public async Task CalculateNetWorth_EmptyPortfolio() { var guid = Guid.NewGuid(); authService.Stub(x => x.AuthenticateUserAsync("jon", "pass")).Return(Delayed <Guid?>(100, guid)); portfolioService.Stub(x => x.GetPortfolioAsync(guid)).Return(Delayed(200, new List <StockHolding>())); Assert.AreEqual(0m, await broker.CalculateWorthAsync("jon", "pass")); }
public void CalculateNetWorth_EmptyPortfolio() { var tardis = new TimeMachine(); var guid = Guid.NewGuid(); var loginResult = tardis.ScheduleSuccess <Guid?>(1, guid); var portfolioResult = tardis.ScheduleSuccess(2, new List <StockHolding>()); authService.Stub(x => x.AuthenticateUserAsync("jon", "pass")).Return(loginResult); portfolioService.Stub(x => x.GetPortfolioAsync(guid)).Return(portfolioResult); tardis.ExecuteInContext(advancer => { var worth = broker.CalculateWorthAsync("jon", "pass"); Assert.IsFalse(worth.IsCompleted); advancer.Advance(); Assert.IsFalse(worth.IsCompleted); advancer.Advance(); AssertCompletion(worth, 0); }); }