public static async Task WhenParamIsNullResultExeptionAsync() { var strngr = new Mock <IStreinger>(); strngr.Setup(ex => ex.Goods()).Returns(Task.FromResult((IEnumerable <Good>)null)); var algo = new Mock <ITopAlgorithm>(); var search = new preparation.Controllers.SearchController(streinger: strngr.Object, topAlgorithm: algo.Object); NUnitAssert.CatchAsync(async() => search.StackLogic(await strngr.Object.Goods() as IEnumerable <IProduct>)); }
public async Task WhenStreingerReturnNULLResultExeption() { var strngr = new Mock <IStreinger>(); strngr.Setup(ex => ex.Goods()).Returns(Task.FromResult((IEnumerable <Good>)null)); var algo = new TopAlgorithm(); var search = new preparation.Controllers.SearchController(streinger: strngr.Object, topAlgorithm: algo); NUnitAssert.CatchAsync(async() => await search.Index()); }
public override void Execute(AsyncTestDelegate asyncUserCode) { var ex = (Exception)null; using (new TestExecutionContext.IsolatedContext()) { try { ex = Assert.CatchAsync(asyncUserCode); } catch { } } if (ex != null) { ExceptionHelper.Rethrow(ex); } }
public async Task WhenCompanyNameOrProductNameNullResultExeption() { var goods = new Good[] { new Good() { Product = new Preparation() { }, Supplier = new Supplier() { } } }.AsEnumerable(); var strngr = new Mock <IStreinger>(); strngr.Setup(ex => ex.Goods()).Returns(Task.FromResult(goods)); var algo = new TopAlgorithm(); var search = new preparation.Controllers.SearchController(streinger: strngr.Object, topAlgorithm: algo); NUnitAssert.CatchAsync <ArgumentNullException>(async() => await search.Index()); }