コード例 #1
0
        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);
        }
コード例 #2
0
 protected override string GetStringId(int value)
 {
     return(HexadecimalObfuscationCodec.Encode(value));
 }