public static FutureMock <TValue> AsFuture <TValue>(this TValue value) { var future = new FutureMock <TValue>(); future.SetValue(value); return(future); }
public GetStockDetailsTest() { this.symbol = "AnySymbol"; this.detail = new FutureMock <StockDetailModel>(); this.stockService = new Mock <IStockService>(); }
public GetStockDetailsTest() { this.symbol = "AnySymbol"; this.detail = new FutureMock<StockDetailModel>(); this.stockService = new Mock<IStockService>(); }
public void CalculateAsyncInFunction() { Test(@"var f = x => { var y = await calcAsync(20); return x + y; }; f(5)", 10.0, engine => engine.SetFunction("calcAsync", FutureMock.Number(5.0))); }
public void ShouldAllowNullSearchModel() { var future = new FutureMock <StockDetailModel>(); ConductStockTickerContent testee = this.CreateTestee(future); System.Action act = () => testee.Execute(new ActionExecutionContext()); act.ShouldNotThrow(); }
public void ShouldAllowNullSearchModel() { var future = new FutureMock<StockDetailModel>(); ConductStockTickerContent testee = this.CreateTestee(future); System.Action act = () => testee.Execute(new ActionExecutionContext()); act.ShouldNotThrow(); }
public void CalculateAsyncFunctionInForLoop() { Test(@"var sum = 0.0; for (var i = 0; i < 5; ++i) { sum += await calcAsync(10); } sum ", 15.0, engine => engine.SetFunction("calcAsync", FutureMock.Number(3.0))); }
public void CalculateMultipleAsyncInFunction() { Test(@"var f = x => { var y = await barAsync(20); var z = await fooAsync(5); return x + y * z; }; f(5)", 80, engine => { engine.SetFunction("barAsync", FutureMock.Number(5.0)); engine.SetFunction("fooAsync", FutureMock.Number(15.0)); }); }
private ConductStockTickerContent CreateTestee(FutureMock <StockDetailModel> search) { return(new ConductStockTickerContent(search, d => this.detail = d, this.contentFactory.Object)); }
public ConductStockTickerContentTest() { this.searchModel = new AnyStockDetailModel().AsFuture <StockDetailModel>(); this.contentFactory = new Mock <IContentViewModelFactory>(); }
private ConductStockTickerContent CreateTestee(FutureMock<StockDetailModel> search) { return new ConductStockTickerContent(search, d => this.detail = d, this.contentFactory.Object); }
public ConductStockTickerContentTest() { this.searchModel = new AnyStockDetailModel().AsFuture<StockDetailModel>(); this.contentFactory = new Mock<IContentViewModelFactory>(); }