public static void Verify(this AstoriaResponse response, bool throwOnError) { try { if (response.Request.URI.Contains("$value") && response.ActualStatusCode == System.Net.HttpStatusCode.NotFound && response.Request.ExpectedStatusCode == System.Net.HttpStatusCode.OK) { // Skip statuscode verification if $value request returns unexpected NotFound (means that value was null) // This should be verified by ExtraVerification step (VerifyGet) } else if (response.ActualStatusCode == System.Net.HttpStatusCode.NoContent && response.Request.Verb == RequestVerb.Get) { // Skip if nav prop is null. Expected status code would be OK but NoContent will be returned } else { VerifyStatusCode(response); } if ((int)response.ActualStatusCode >= 400 || response.Request.ErrorExpected) { VerifyError(response); } else if (response is BatchResponse) { //Batching in V1 had a bug in this area, so only check it its a V2 server if (Versioning.Server.SupportsV2Features) { VerifySpecificResponseVersion(response, 1, 0); } foreach (AstoriaResponse subResponse in (response as BatchResponse).Responses) { subResponse.Verify(); } } else { if (response.Request.MetadataOnly) { VerifyMetadata(response); } else { VerifyConcurrency(response); if (InsertVerifier.Applies(response)) { InsertVerifier.Verify(response); } if (UpdateVerifier.Applies(response)) { UpdateVerifier.Verify(response); } if (DeleteVerifier.Applies(response)) { DeleteVerifier.Verify(response); } // always do this last in case it has side-effects if (response.Request.ExtraVerification != null) { response.Request.ExtraVerification(response); } } } } catch (Exception ex) { LogFailure(response, ex, throwOnError); } }
public static void Verify(AstoriaResponse response) { InsertVerifier verifier = new InsertVerifier(response); verifier.Verify(); }