Пример #1
0
        public async Task When_Delete_Unknown_Resource_Then_Error_Is_Returned()
        {
            // ARRANGE
            InitializeFakeObjects();
            _httpClientFactoryStub.Setup(h => h.GetHttpClient()).Returns(_server.Client);

            // ACT
            var resource = await _resourceSetClient.DeleteByResolution("unknown",
                                                                       baseUrl + "/.well-known/uma2-configuration", "header");

            // ASSERT
            Assert.NotNull(resource);
            Assert.True(resource.ContainsError);
            Assert.Equal("not_found", resource.Error.Error);
            Assert.Equal("resource cannot be found", resource.Error.ErrorDescription);
        }
        public async Task When_Deleting_ResourceInformation_Then_It_Doesnt_Exist()
        {
            const string baseUrl = "http://localhost:5000";

            // ARRANGE
            InitializeFakeObjects();
            _httpClientFactoryStub.Setup(h => h.GetHttpClient()).Returns(_server.Client);

            // ACT
            var resources = await _resourceSetClient.GetAllByResolution(
                baseUrl + "/.well-known/uma-configuration", "header");

            var resource = await _resourceSetClient.DeleteByResolution(resources.First(),
                                                                       baseUrl + "/.well-known/uma-configuration", "header");

            var information = await Assert.ThrowsAsync <HttpRequestException>(() => _resourceSetClient.GetByResolution(resources.First(),
                                                                                                                       baseUrl + "/.well-known/uma-configuration", "header"));

            // ASSERT
            Assert.True(resource);
            Assert.NotNull(information);
        }