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 async Task WhenStreingerReturnOKDataResultOKModel() { var algo = new TopAlgorithm(); var search = new preparation.Controllers.SearchController(streinger: strngr, topAlgorithm: algo); var resp = await search.Index(); NUnitAssert.IsAssignableFrom(typeof(ViewResult), resp); NUnitAssert.NotNull(resp); var model = (resp as ViewResult).ViewData.Model; NUnitAssert.NotNull(model); NUnitAssert.IsAssignableFrom <IEnumerable <IProduct>[]>(model); }
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()); }