public void Filter_RedirectsToPreviewPage_WhenTheConferenceIsInPreview() { var conferenceLoader = new ConferenceLoaderBuilder() .InPreview() .Build(); var filterAttribute = new ConferenceIsInPreviewFilter(conferenceLoader); var filterContext = new ActionExecutingContext(); filterAttribute.OnActionExecuting(filterContext); Assert.That(filterContext.Result.GetRedirectionUrl(), Contains.Substring("Preview")); }
public void Filter_DoesNotRedirectToPreviewPage_WhenTheConferenceIsNotInPreview() { var conferenceLoader = new ConferenceLoaderBuilder() .NotInPreview() .Build(); var filterAttribute = new ConferenceIsInPreviewFilter(conferenceLoader); var filterContext = new ActionExecutingContext(); filterAttribute.OnActionExecuting(filterContext); Assert.That(filterContext.Result, Is.Not.InstanceOf<RedirectResult>()); }