private static bool UpdateQuery(ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { switch (suffix) { case ContainmentQuerySuffix.SingleNavigationTwice: return(ApplyNavigationProperties(query, Multiplicity.One, Multiplicity.One)); case ContainmentQuerySuffix.SingleNavigation: return(ApplyNavigationProperties(query, Multiplicity.One)); case ContainmentQuerySuffix.MultipleNavigation: return(ApplyNavigationProperties(query, Multiplicity.Many)); case ContainmentQuerySuffix.LinkedSingleNavigation: return(ApplyLink(query, Multiplicity.One)); case ContainmentQuerySuffix.LinkedMultipleNavigation: return(ApplyLink(query, Multiplicity.Many)); case ContainmentQuerySuffix.SimpleType: return(ApplySimpleType(query)); case ContainmentQuerySuffix.None: return(true); default: return(false); } }
private static bool MethodAllowed(ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { if (query.SetExpected) { if (suffix != ContainmentQuerySuffix.None) { AstoriaTestLog.FailAndThrow("Only the NONE suffix can be used when a set is expected"); } return(verb == RequestVerb.Get || verb == RequestVerb.Post); } else { return(VerbMap.Valid(suffix, verb)); } }
private static void UpdateErrorState(ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { if (!MethodAllowed(query, suffix, verb)) { // TODO: set error identifier? query.ExpectedStatusCode = HttpStatusCode.MethodNotAllowed; switch (verb) { case RequestVerb.Post: query.ExpectedErrorIdentifier = SystemDataServicesResourceIdentifiers.BadRequest_InvalidUriForPostOperation; UriQueryBuilder builder = new UriQueryBuilder(query.Workspace, query.Workspace.ServiceEndPoint); query.ExpectedErrorArgs = new object[] { builder.Build(query.Query) }; break; } } }
public static bool AppendSuffix(this ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { UpdateErrorState(query, suffix, verb); return(UpdateQuery(query, suffix, verb)); }
public static bool AppendSuffix(this ContainmentQuery query, ContainmentQuerySuffix suffix) { return(query.AppendSuffix(suffix, RequestVerb.Get)); }
public static bool AppendSuffix(this ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { UpdateErrorState(query, suffix, verb); return UpdateQuery(query, suffix, verb); }
public static bool Valid(ContainmentQuerySuffix suffix, RequestVerb verb) { return(map[suffix].Contains(verb)); }
public static bool AppendSuffix(this ContainmentQuery query, ContainmentQuerySuffix suffix) { return query.AppendSuffix(suffix, RequestVerb.Get); }
private static bool UpdateQuery(ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { switch (suffix) { case ContainmentQuerySuffix.SingleNavigationTwice: return ApplyNavigationProperties(query, Multiplicity.One, Multiplicity.One); case ContainmentQuerySuffix.SingleNavigation: return ApplyNavigationProperties(query, Multiplicity.One); case ContainmentQuerySuffix.MultipleNavigation: return ApplyNavigationProperties(query, Multiplicity.Many); case ContainmentQuerySuffix.LinkedSingleNavigation: return ApplyLink(query, Multiplicity.One); case ContainmentQuerySuffix.LinkedMultipleNavigation: return ApplyLink(query, Multiplicity.Many); case ContainmentQuerySuffix.SimpleType: return ApplySimpleType(query); case ContainmentQuerySuffix.None: return true; default: return false; } }
private static bool MethodAllowed(ContainmentQuery query, ContainmentQuerySuffix suffix, RequestVerb verb) { if (query.SetExpected) { if (suffix != ContainmentQuerySuffix.None) { AstoriaTestLog.FailAndThrow("Only the NONE suffix can be used when a set is expected"); } return verb == RequestVerb.Get || verb == RequestVerb.Post; } else { return VerbMap.Valid(suffix, verb); } }
public static bool Valid(ContainmentQuerySuffix suffix, RequestVerb verb) { return map[suffix].Contains(verb); }