コード例 #1
0
        public async Task Update_Request_To_Not_Found_When_No_Template()
        {
            UmbracoRouteValuesFactory factory = GetFactory(out Mock <IPublishedRouter> publishedRouter, out _, out IPublishedRequest request);

            UmbracoRouteValues result = await factory.CreateAsync(new DefaultHttpContext(), request);

            // The request has content, no template, no hijacked route and no disabled template features so UpdateRequestToNotFound will be called
            publishedRouter.Verify(m => m.UpdateRequestAsync(It.IsAny <IPublishedRequest>(), null), Times.Once);
        }
コード例 #2
0
        public async Task Adds_Result_To_Route_Value_Dictionary()
        {
            UmbracoRouteValuesFactory factory = GetFactory(out _, out IOptions <UmbracoRenderingDefaultsOptions> renderingDefaults, out IPublishedRequest request);

            UmbracoRouteValues result = await factory.CreateAsync(new DefaultHttpContext(), request);

            Assert.IsNotNull(result);
            Assert.AreEqual(renderingDefaults.Value.DefaultControllerType, result.ControllerType);
            Assert.AreEqual(UmbracoRouteValues.DefaultActionName, result.ActionName);
            Assert.IsNull(result.TemplateName);
        }