コード例 #1
0
        protected HttpIntegrationTestBase(UrlPathPrefixBehaviour pathPrefixBehaviour)
        {
            TestRootPath = "/";
            if (pathPrefixBehaviour == UrlPathPrefixBehaviour.UseClassNameAsUrlPathPrefix)
            {
                TestRootPath = $"/{GetType().Name}";
            }

            Get($"{TestRootPath}/api", p => Response.AsJson(
                    new RootResource()
            {
                ApiVersion     = "3.0.0",
                Version        = "2099.0.0",
                InstallationId = InstallationId,
                Links          = new LinkCollection()
                {
                    { "CurrentUser", $"{TestRootPath}/api/users/me" },
                    { "SpaceHome", $"{TestRootPath}/api/{{spaceId}}" },
                    { "Users", $"{TestRootPath}/api/users/{{id}}" },
                    { "SignIn", $"{TestRootPath}/api/users/login" },
                    { "Machines", $"{TestRootPath}/api/machines" },
                }
            }
                    ));
            Get($"{TestRootPath}/api/users/me", p => Response.AsJson(
                    new UserResource()
            {
                Links = new LinkCollection()
                {
                    { "Spaces", TestRootPath + "/api/users/users-1/spaces" }
                }
            }
                    ));
            Get($"{TestRootPath}/api/users/users-1/spaces", p => Response.AsJson(
                    new[] {
                new SpaceResource()
                {
                    Id = "Spaces-1", IsDefault = true
                },
                new SpaceResource()
                {
                    Id = "Spaces-2", IsDefault = false
                }
            }
                    ));
            Get($"{TestRootPath}/api/spaces-1", p => Response.AsJson(
                    new SpaceRootResource()
                    ));
        }
コード例 #2
0
        protected HttpIntegrationTestBase(UrlPathPrefixBehaviour pathPrefixBehaviour)
        {
            TestRootPath = "/";
            if (pathPrefixBehaviour == UrlPathPrefixBehaviour.UseClassNameAsUrlPathPrefix)
            {
                TestRootPath = $"/{GetType().Name}/";
            }

            Get($"{TestRootPath}api", p => Response.AsJson(
                    new RootResource()
            {
                ApiVersion     = "3.0.0",
                InstallationId = InstallationId,
                Links          = new LinkCollection()
                {
                    { "CurrentUser", $"{TestRootPath}/api/users/me" }
                }
            }
                    ));
        }