コード例 #1
0
        public Task CanConnectToTestServer() =>
        _apiHelper.InTheContextOfAnAnonymousUser(
            async httpClient =>
        {
            // Act
            var response = await httpClient
                           .GetAsync("health");

            // Assert
            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        });
コード例 #2
0
        public Task RequestingTheApiRootShouldReturnProperHypermediaLinksWhenNotLoggedIn() =>
        _apiHelper.InTheContextOfAnAnonymousUser(
            async httpClient =>
        {
            // Act
            var response = await httpClient
                           .GetAsync(httpClient.BaseAddress);

            // Assert
            var expectedLinks = new List <string>
            {
                LinkNames.Auth.Login,
                LinkNames.Auth.Register
            };

            await response.ShouldBeAResource <ApiRootResource>(expectedLinks);
        });