public async Task Fail_When_Deleting_Missing_Passport() { // Arrange string passportId = HexadecimalObfuscationCodec.Encode(1234567890); var request = new HttpRequestMessage(HttpMethod.Delete, "/api/v1/passports/" + passportId); // Act var response = await _fixture.Client.SendAsync(request); // Assert _fixture.AssertEqualStatusCode(HttpStatusCode.NotFound, response); var body = await response.Content.ReadAsStringAsync(); var errorDocument = JsonConvert.DeserializeObject <ErrorDocument>(body); Assert.Single(errorDocument.Errors); Assert.Equal(HttpStatusCode.NotFound, errorDocument.Errors[0].StatusCode); Assert.Equal("The requested resource does not exist.", errorDocument.Errors[0].Title); Assert.Equal("Resource of type 'passports' with ID '" + passportId + "' does not exist.", errorDocument.Errors[0].Detail); }
public async Task <IActionResult> DeleteAsync(string id) { int idValue = HexadecimalObfuscationCodec.Decode(id); return(await base.DeleteAsync(idValue)); }
public async Task <IActionResult> PatchAsync(string id, [FromBody] Passport resource) { int idValue = HexadecimalObfuscationCodec.Decode(id); return(await base.PatchAsync(idValue, resource)); }
protected override int GetTypedId(string value) { return(HexadecimalObfuscationCodec.Decode(value)); }
protected override string GetStringId(int value) { return(HexadecimalObfuscationCodec.Encode(value)); }