示例#1
0
        public async Task Should_return_not_found_if_schema_name_is_null(string?schema)
        {
            actionContext.RouteData.Values["schema"] = schema;

            await sut.OnActionExecutionAsync(actionExecutingContext, next);

            AssertNotFound();

            A.CallTo(() => appProvider.GetSchemaAsync(appId.Id, A <DomainId> ._, true, httpContext.RequestAborted))
            .MustNotHaveHappened();
        }
示例#2
0
        public async Task Should_return_not_found_if_schema_not_found()
        {
            actionExecutingContext.HttpContext.Features.Set <IAppFeature>(new AppFeature(appId));
            actionContext.RouteData.Values["name"] = schemaId.Id.ToString();

            A.CallTo(() => appProvider.GetSchemaAsync(appId.Id, schemaId.Id, false))
            .Returns(Task.FromResult <ISchemaEntity?>(null));

            await sut.OnActionExecutionAsync(actionExecutingContext, next);

            Assert.IsType <NotFoundResult>(actionExecutingContext.Result);
            Assert.False(isNextCalled);
        }
        public async Task Should_return_not_found_if_schema_not_published_when_attribute_applied()
        {
            actionContext.ActionDescriptor.EndpointMetadata.Add(new SchemaMustBePublishedAttribute());
            actionContext.RouteData.Values["schema"] = schemaId.Id.ToString();

            var schema = CreateSchema(false);

            A.CallTo(() => appProvider.GetSchemaAsync(appId.Id, A <DomainId> ._, true, httpContext.RequestAborted))
            .Returns(schema);

            await sut.OnActionExecutionAsync(actionExecutingContext, next);

            AssetNotFound();
        }