public void Should_add_location_header_to_the_message_when_response_contains_a_api_resource() { var apiResource = new TestResource(); var response = new NotModifiedResponse(apiResource); AssertExpectedStatus(response); response.Headers.Location.ShouldEqual(apiResource.Location); }
[Api.HttpPatch] //(MatchAllBodyParameters = false)] public async static Task <HttpResponseMessage> UpdateAsync( [Property(Name = IntegrationIdPropertyName)] IRef <Integration> integrationRef, [Property(Name = AuthorizationPropertyName)] IRef <Authorization> authorizationRef, Api.Azure.AzureApplication application, EastFive.Api.SessionToken security, ContentTypeResponse <Integration> onUpdated, NotFoundResponse onNotFound, NotModifiedResponse onNotModified, ForbiddenResponse onForbidden, ReferencedDocumentDoesNotExistsResponse <Authorization> onAuthenticationDoesNotExist, UnauthorizedResponse onUnauthorized) { return(await integrationRef.StorageUpdateAsync( async (integration, saveAsync) => { var accountId = integration.accountId; if (!await application.CanAdministerCredentialAsync(accountId, security)) { return onUnauthorized(); } return await await authorizationRef.StorageGetAsync( async authorization => { // TODO? This // var accountIdDidMatch = await await authorization.ParseCredentailParameters( integration.Method = authorization.Method; // method is used in the .mappingId integration.authorization = authorizationRef.Optional(); return await await SaveAuthorizationLookupAsync(integration.integrationRef, authorization.authorizationRef, async() => { await saveAsync(integration); return await SaveAccountLookupAsync(accountId, integration, () => onUpdated(integration)); }, () => { // TODO: Check if mapping is to this integration and reply already created. return onForbidden().AddReason("Authorization is already in use.").AsTask(); }); }, () => { return onNotModified().AsTask(); }); }, () => onNotFound())); }
public void Should_return_an_http_response_message_with_expected_status() { var response = new NotModifiedResponse(); AssertExpectedStatus(response); }