public void OnPostTrafficDensity_IfValidModel_ReturnPage() { var pageModel = new SearchListModel(); string testString = "test"; var result = pageModel.OnPostTrafficDensity(testString); Assert.IsType <PageResult>(result); }
public void OnPostTrafficDensity_IfInvalidModel_ReturnBadRequest() { var pageModel = new SearchListModel(); pageModel.ModelState.AddModelError("Error", "Bad request: OnPostSearchList method failed in SearchList.cshtml.cs."); string testString = "test"; var result = pageModel.OnPostTrafficDensity(testString); Assert.IsType <BadRequestResult>(result); }