public void should_set_the_name_for_output_types() { Spec.GetEndpoint <OutputTypeDescriptions.GetHandler>().Response.Body.Description[0].Name.ShouldEqual("GetResponse"); Spec.GetEndpoint <OutputTypeDescriptions.PostHandler>().Response.Body.Description[0].Name.ShouldEqual("PostResponse"); Spec.GetEndpoint <OutputTypeDescriptions.PutHandler>().Response.Body.Description[0].Name.ShouldEqual("PutResponse"); Spec.GetEndpoint <OutputTypeDescriptions.DeleteHandler>().Response.Body.Description[0].Name.ShouldEqual("DeleteResponse"); }
public void should_set_input_type_collection_name_to_the_xml_type_name() { var request = Spec.GetEndpoint <InputTypeDescriptions.OverridenCollectionPostHandler>().Request; request.Comments.ShouldBeNull(); request.Body.Description[0].Name.ShouldEqual("NewCollectionName"); }
public void should_hide_parameters_marked_with_the_hide_sttribute() { Spec.GetEndpoint <Querystrings.ImplicitGetHandler>().QuerystringParameters.Any(x => x.Name == "HiddenParameter").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ImplicitDeleteHandler>().QuerystringParameters.Any(x => x.Name == "HiddenParameter").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ExplicitPostHandler>().QuerystringParameters.Any(x => x.Name == "HiddenParameter").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ExplicitPutHandler>().QuerystringParameters.Any(x => x.Name == "HiddenParameter").ShouldBeFalse(); }
public void should_set_endpoint_status_codes_on_handlers_and_actions() { var endpoint = Spec.GetEndpoint <StatusCodeDescriptions.StatusCodesGetHandler>(); endpoint.StatusCodes.Count.ShouldEqual(4); var statusCode = endpoint.StatusCodes[0]; statusCode.Code.ShouldEqual(410); statusCode.Name.ShouldEqual("410 error on handler"); statusCode.Comments.ShouldEqual("410 error on action description"); statusCode = endpoint.StatusCodes[1]; statusCode.Code.ShouldEqual(411); statusCode.Name.ShouldEqual("411 error on handler"); statusCode.Comments.ShouldBeNull(); statusCode = endpoint.StatusCodes[2]; statusCode.Code.ShouldEqual(412); statusCode.Name.ShouldEqual("412 error on action"); statusCode.Comments.ShouldEqual("412 error on action description"); statusCode = endpoint.StatusCodes[3]; statusCode.Code.ShouldEqual(413); statusCode.Name.ShouldEqual("413 error on action"); statusCode.Comments.ShouldBeNull(); }
public void should_set_output_type_name_to_the_xml_type_name() { var response = Spec.GetEndpoint <OutputTypeDescriptions.OverridenRequestPostHandler>().Response; response.Comments.ShouldBeNull(); response.Body.Description[0].Name.ShouldEqual("NewItemName"); }
public void should_not_set_endpoint_headers_when_none_are_set_on_handlers_or_actions() { var endpoint = Spec.GetEndpoint <MimeTypeDescriptions.NoMimeTypesGetHandler>(); endpoint.Request.MimeTypes.Count.ShouldEqual(0); endpoint.Response.MimeTypes.Count.ShouldEqual(0); }
public void should_exclude_auto_bound_properties() { Spec.GetEndpoint <Querystrings.ImplicitGetHandler>().QuerystringParameters.Any(x => x.Name == "ContentType").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ImplicitDeleteHandler>().QuerystringParameters.Any(x => x.Name == "ContentType").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ExplicitPostHandler>().QuerystringParameters.Any(x => x.Name == "ContentType").ShouldBeFalse(); Spec.GetEndpoint <Querystrings.ExplicitPutHandler>().QuerystringParameters.Any(x => x.Name == "ContentType").ShouldBeFalse(); }
public void should_set_endpoint_headers_on_handlers_and_actions() { var endpoint = Spec.GetEndpoint <HeaderDescriptions.HeadersGetHandler>(); endpoint.Headers.Count.ShouldEqual(4); var header = endpoint.Headers[0]; header.Type.ShouldEqual("Request"); header.Name.ShouldEqual("accept"); header.Comments.ShouldEqual("This is an endpoint description."); header.Optional.ShouldBeTrue(); header = endpoint.Headers[1]; header.Type.ShouldEqual("Request"); header.Name.ShouldEqual("api-key"); header.Comments.ShouldEqual("This is a handler description."); header.Optional.ShouldBeTrue(); header = endpoint.Headers[2]; header.Type.ShouldEqual("Response"); header.Name.ShouldEqual("content-length"); header.Comments.ShouldBeNull(); header.Optional.ShouldBeFalse(); header = endpoint.Headers[3]; header.Type.ShouldEqual("Response"); header.Name.ShouldEqual("content-type"); header.Comments.ShouldBeNull(); header.Optional.ShouldBeFalse(); }
public void should_set_post_input_type_description() { var request = Spec.GetEndpoint <InputTypeDescriptions.PostHandler>().Request; request.Comments.ShouldEqual("Some post request description"); request.Body.Description[0].IsComplexType.ShouldEqual(true); }
public void should_order_querystring_options_by_name_or_value() { var options = Spec.GetEndpoint <Querystrings.OptionGetHandler>() .GetQuerystring <Querystrings.OptionRequest>(x => x.Options).Options; options.Options[0].Value.ShouldEqual("Option1"); options.Options[1].Value.ShouldEqual("Option3"); }
public void should_generate_id_based_on_the_url() { const string url = "/endpointdescriptions/nodescription"; var endpoint = Spec.GetEndpoint <EndpointDescriptions.NoDescriptionGetHandler>(); endpoint.Id.ShouldEqual($"{url}:GET".Hash()); endpoint.Url.ShouldEqual(url); }
public void should_set_output_type_collection_name_to_the_xml_type_name() { var response = Spec.GetEndpoint <OutputTypeDescriptions.OverridenCollectionPostHandler>().Response; response.Comments.ShouldBeNull(); response.Body.Description[0].Name.ShouldEqual("NewCollectionName"); response.Body.Description[0].IsArray.ShouldEqual(true); }
public void should_set_input_type_default_collection_name_and_datatype() { var request = Spec.GetEndpoint <InputTypeDescriptions.CollectionPostHandler>().Request; request.Comments.ShouldBeNull(); request.Body.Description[0].Name.ShouldEqual("ArrayOfRequestItem"); request.Body.Description[0].IsArray.ShouldEqual(true); }
public void should_set_output_type_default_collection_name_of_inherited_collection_and_datatype() { var response = Spec.GetEndpoint <OutputTypeDescriptions.InheritedCollectionPostHandler>().Response; response.Comments.ShouldBeNull(); response.Body.Description[0].Name.ShouldEqual("ArrayOfResponseItem"); response.Body.Description[0].IsArray.ShouldEqual(true); }
public void should_set_get_output_type_description() { var response = Spec.GetEndpoint <OutputTypeDescriptions.GetHandler>().Response; response.Name.ShouldEqual("GetResponse"); response.Comments.ShouldEqual("Some get response description"); response.IsArray.ShouldBeFalse(); }
public void should_set_post_input_type_description() { var request = Spec.GetEndpoint <InputTypeDescriptions.PostHandler>().Request; request.Name.ShouldEqual("PostRequest"); request.Comments.ShouldEqual("Some post request description"); request.IsArray.ShouldBeFalse(); }
public void should_order_url_paramaters_options_by_name_or_value() { var options = Spec.GetEndpoint <UrlParameters.OptionGetHandler>() .GetUrlParameter <UrlParameters.OptionRequest>(x => x.Options).Options; options[0].Value.ShouldEqual("Option1"); options[1].Value.ShouldEqual("Option3"); }
public void should_enumerate_url_parameters_ordered_by_position_in_the_url() { var parameters = Spec.GetEndpoint <UrlParameters.GetHandler>().UrlParameters; parameters.Count.ShouldEqual(2); parameters[0].Name.ShouldEqual("WidgetId"); parameters[1].Name.ShouldEqual("Revision"); }
public void should_set_comments_default_when_there_is_no_comments_attribute() { var parameter = Spec.GetEndpoint <Querystrings.ImplicitGetHandler>() .GetQuerystring <Querystrings.Request>(x => x.Sort); parameter.Name.ShouldEqual("Sort"); parameter.Comments.ShouldBeNull(); parameter.Options.ShouldBeNull(); }
public void should_set_handler_description_for_delete_endpoint() { var endpoint = Spec.GetEndpoint <EndpointDescriptions.HandlerDescription.DeleteHandler>(); endpoint.Name.ShouldEqual("Some delete handler name"); endpoint.Comments.ShouldEqual("Some delete handler description"); endpoint.Method.ShouldEqual("DELETE"); endpoint.Url.ShouldEqual("/endpointdescriptions/handlerdescription/delete/{Id}"); }
public void should_not_set_handler_description_for_endpoint_with_no_description() { var endpoint = Spec.GetEndpoint <EndpointDescriptions.NoDescriptionGetHandler>(); endpoint.Name.ShouldBeNull(); endpoint.Comments.ShouldBeNull(); endpoint.Method.ShouldEqual("GET"); endpoint.Url.ShouldEqual("/endpointdescriptions/nodescription"); }
public void should_set_output_type_name_to_the_xml_type_name() { var response = Spec.GetEndpoint <OutputTypeDescriptions.OverridenRequestPostHandler>().Response; response.Name.ShouldEqual("NewItemName"); response.Comments.ShouldBeNull(); response.Type.ShouldEqual(typeof(OutputTypeDescriptions.OverridenResponseItem).GetHash()); response.IsArray.ShouldBeFalse(); }
public void should_set_output_type_default_collection_name_of_inherited_collection_and_datatype_should_be_a_hash_of_the_element_type_and_action() { var response = Spec.GetEndpoint <OutputTypeDescriptions.InheritedCollectionPostHandler>().Response; response.Name.ShouldEqual("ArrayOfResponseItem"); response.Comments.ShouldBeNull(); response.Type.ShouldEqual(typeof(OutputTypeDescriptions.ResponseItem).GetHash()); response.IsArray.ShouldBeTrue(); }
public void should_set_url_paramaters_option_description_to_default_when_not_specified() { var option = Spec.GetEndpoint <UrlParameters.OptionGetHandler>() .GetUrlParameter <UrlParameters.OptionRequest>(x => x.Options).Options[1]; option.Name.ShouldEqual("Option3"); option.Value.ShouldEqual("Option3"); option.Comments.ShouldBeNull(); }
public void should_get_url_paramaters_option_description() { var option = Spec.GetEndpoint <UrlParameters.OptionGetHandler>() .GetUrlParameter <UrlParameters.OptionRequest>(x => x.Options).Options[0]; option.Name.ShouldEqual("Option 1"); option.Value.ShouldEqual("Option1"); option.Comments.ShouldEqual("Option 1 description."); }
public void should_set_embedded_markdown_action_description() { var endpoint = Spec.GetEndpoint <EndpointDescriptions.ActionDescription.EmbeddedDescriptionGetHandler>(); endpoint.Name.ShouldBeNull(); endpoint.Comments.ShouldEqual("<p><strong>An embedded action markdown description</strong></p>"); endpoint.Method.ShouldEqual("GET"); endpoint.Url.ShouldEqual("/endpointdescriptions/actiondescription/embeddeddescription"); }
public void should_indicate_when_the_parameter_is_required() { var endpoint = Spec.GetEndpoint <Querystrings.ImplicitGetHandler>(); endpoint.GetQuerystring <Querystrings.Request>(x => x.NotRequiredParameter).Required.ShouldBeFalse(); endpoint.GetQuerystring <Querystrings.Request>(x => x.NullableId).Required.ShouldBeFalse(); endpoint.GetQuerystring <Querystrings.Request>(x => x.Sort).Required.ShouldBeTrue(); endpoint.GetQuerystring <Querystrings.Request>(x => x.Revisions).Required.ShouldBeTrue(); }
public void should_set_comments_when_there_is_a_comments_attribute() { var parameter = Spec.GetEndpoint <Querystrings.ImplicitGetHandler>() .GetQuerystring <Querystrings.Request>(x => x.Revisions); parameter.Name.ShouldEqual("Revisions"); parameter.Comments.ShouldEqual("These are the revision numbers."); parameter.Options.ShouldBeNull(); }
public void should_get_querystring_option_description() { var option = Spec.GetEndpoint <Querystrings.OptionGetHandler>() .GetQuerystring <Querystrings.OptionRequest>(x => x.Options).Options.Options[0]; option.Name.ShouldEqual("Option 1"); option.Value.ShouldEqual("Option1"); option.Comments.ShouldEqual("Option 1 description."); }
public void should_set_querystring_option_description_to_default_when_not_specified() { var option = Spec.GetEndpoint <Querystrings.OptionGetHandler>() .GetQuerystring <Querystrings.OptionRequest>(x => x.Options).Options.Options[1]; option.Name.ShouldEqual("Option3"); option.Value.ShouldEqual("Option3"); option.Comments.ShouldBeNull(); }