public void NotFoundViewTestIncludeMessage() { var message = "testpage.html"; var view = new NotFoundView(message); Assert.IsTrue(view.Content.Contains(message), $"in NotFound.Content: {view.Content} does not contains {message}"); }
protected override void OnInit(EventArgs e) { string culture = Request.QueryString["culture"]; if (!string.IsNullOrEmpty(culture)) { Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); } string uiCulture = Request.QueryString["uiculture"]; if (!string.IsNullOrEmpty(uiCulture)) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(uiCulture); } base.OnInit(e); if (!IsPostBack) { List <int> invalidRowIds; if (UrlTrackerRepository.HasInvalidEntries(out invalidRowIds)) { ltlError.Text = string.Format(UrlTrackerResources.ErrorMessageOldUrlAndOldRegexEmpty, string.Join(", ", invalidRowIds)); lbDeleteErrorRows.Text = UrlTrackerResources.ErrorMessageOldUrlAndOldRegexEmptyButton; mvUrlTrackerError.SetActiveView(vwUrlTrackerErrorMessage); odsUrlTrackerEntries.Selecting += odsUrlTrackerEntries_Selecting; } gvUrlTracker.Sort("Inserted", SortDirection.Descending); gvNotFound.Sort("NotFoundCount", SortDirection.Descending); } if (!_earlyErrorDetected) { pnlBreadcrumb.Visible = false; if (icAutoView == null) { icAutoView = (AutoView)LoadControl("~/Umbraco/UrlTracker/InfoCaster.Umbraco.UrlTracker.UI.UserControls.AutoView.ascx"); icCustomView = (CustomView)LoadControl("~/Umbraco/UrlTracker/InfoCaster.Umbraco.UrlTracker.UI.UserControls.CustomView.ascx"); icNotFoundView = (NotFoundView)LoadControl("~/Umbraco/UrlTracker/InfoCaster.Umbraco.UrlTracker.UI.UserControls.NotFoundView.ascx"); icAdvancedView = (AdvancedView)LoadControl("~/Umbraco/UrlTracker/InfoCaster.Umbraco.UrlTracker.UI.UserControls.AdvancedView.ascx"); icCreateView = (CreateView)LoadControl("~/Umbraco/UrlTracker/InfoCaster.Umbraco.UrlTracker.UI.UserControls.CreateView.ascx"); pnlEditValidationGroup.Controls.AddAt(0, icAutoView); pnlEditValidationGroup.Controls.AddAt(1, icCustomView); pnlEditValidationGroup.Controls.AddAt(2, icNotFoundView); pnlEditValidationGroup.Controls.AddAt(3, icAdvancedView); pnlCreateValidationGroup.Controls.AddAt(0, icCreateView); } } }
public void NotFoundViewStatusCode() { var view = new NotFoundView(); Assert.AreEqual(view.StatusCode, 404); }