コード例 #1
0
        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"));
        }
コード例 #2
0
        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>());
        }