public async Task ShouldLoad_WhenValidRAML() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/raml08/test.raml"); Assert.AreEqual(2, raml.Resources.Count()); }
public async Task ShouldParseSecuritySchemes() { var parser = new RamlParser(); var result = await parser.LoadAsync("box.raml"); Assert.AreEqual(1, result.SecuritySchemes.Count()); }
private async Task <WebApiGeneratorModel> GetContactsGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/contacts.raml"); return(new WebApiGeneratorService(raml, "TestNs").BuildModel()); }
private async Task <WebApiGeneratorModel> GetCongoGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("congo-drones-5-f.raml"); return(new WebApiGeneratorService(raml).BuildModel()); }
public async Task ShouldLoad_WhenAnnotations() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/annotations.raml"); Assert.AreEqual(2, raml.Resources.Count()); }
private async Task <ClientGeneratorModel> GetContactsGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("contacts.raml"); return(new ClientGeneratorService(raml, "test").BuildModel()); }
private async Task <WebApiGeneratorModel> GetGitHubGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("github.raml"); return(new WebApiGeneratorService(raml).BuildModel()); }
public async Task FromFile() { try { Filename = Path.GetFileName(RamlTempFilePath); SetDefaultClientRootClassName(); var result = includesManager.Manage(RamlTempFilePath, Path.GetTempPath(), Path.GetTempPath()); var parser = new RamlParser(); var tempPath = Path.GetTempFileName(); File.WriteAllText(tempPath, result.ModifiedContents); var document = await parser.LoadAsync(tempPath); SetPreview(document); } catch (Exception ex) { ShowErrorAndStopProgress("Error while parsing raml file. " + ex.Message); ActivityLog.LogError(VisualStudioAutomationHelper.RamlVsToolsActivityLogSource, VisualStudioAutomationHelper.GetExceptionInfo(ex)); } }
public async Task ShouldParse_Hybrid() { var parser = new RamlParser(); var raml = await parser.LoadAsync("hybrid-api.raml"); Assert.AreEqual(4, raml.Resources.Count()); }
public async Task ShouldParseFileType() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/chinook-v1.raml"); Assert.AreEqual("file", raml.Types["Person"].Object.Properties["Picture"].Type); }
public async Task ShouldLoad_WhenHasIncludes() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/XKCD/api.raml"); Assert.AreEqual(2, raml.Resources.Count()); }
public async Task ShouldHandleUnionTypes() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/uniontypes.raml"); Assert.AreEqual(3, raml.Types.Count); }
public async Task ShouldBuild_SalesOrder() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/salesOrders.raml"); Assert.AreEqual(18, raml.Types.Count); }
public async Task ShouldLoad_WhenCustomScalar() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/customscalar.raml"); Assert.AreEqual(2, raml.Types.Count); }
public static RamlDocument Load(this RamlParser parser, string ramlFile) { var task = parser.LoadAsync(ramlFile); task.Wait(); return(task.Result); }
private async Task <ClientGeneratorModel> GetGitHubGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/github.raml"); return(new ClientGeneratorService(raml, "test", "TargetNamespace").BuildModel()); }
public async Task ShouldParseHeaders() { var parser = new RamlParser(); var result = await parser.LoadAsync("Specifications/headers.raml"); Assert.AreEqual("Zencoder-Api-Key", result.Resources.First().Methods.First().Headers.Keys.First()); }
public static async Task ShouldLoad_WhenChinnok() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/chinook.raml"); Assert.AreEqual(5, raml.Resources.Count()); }
public static async Task ShouldLoad_WhenXKCD() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/XKCD/api.raml"); Assert.AreEqual(2, raml.Resources.Count()); }
public async Task ShouldHandleNullDescription() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/raml08/null-description.raml"); Assert.IsNull(raml.Resources.First().Methods.First().Description); }
private async Task <RamlDocument> GetRaml() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/raml08/test.raml"); return(raml); }
public async Task ShouldParseSecuritySchemes() { var parser = new RamlParser(); var result = await parser.LoadAsync("Specifications/raml08/box.raml"); Assert.AreEqual(1, result.SecuritySchemes.Count()); }
public async Task ShouldParseMultipleLibraries() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/uses-case.raml"); Assert.AreEqual(14, model.Types.Count); }
private async Task<RamlDocument> GetRaml() { var parser = new RamlParser(); var raml = await parser.LoadAsync("test.raml"); return raml; }
public async Task ShouldLoad_Issue4() { var parser = new RamlParser(); var raml = await parser.LoadAsync("issue4.raml"); Assert.IsNotNull(raml); }
public static async Task ShouldLoad_WhenParams() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/darsparam.raml"); Assert.AreEqual(1, raml.Resources.Count()); }
public static async Task ShouldLoad_WhenExternalRefs() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/external-refs.raml"); Assert.AreEqual(2, raml.Resources.Count()); }
public static async Task ShouldLoad_IncludeWithQuotes() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/relative-include.raml"); Assert.IsNotNull(raml); }
public async Task ShouldLoadFile_WhenValidRAML() { var parser = new RamlParser(); var raml = await parser.LoadAsync("box.raml"); Assert.AreEqual(10, raml.Resources.Count()); Assert.AreEqual(1, raml.Resources.First().Methods.Count()); }
public async Task ShouldParse_WhenHasInclude() { var parser = new RamlParser(); var raml = await parser.LoadAsync("include.raml"); Assert.AreEqual(2, raml.Resources.Count()); Assert.AreEqual(2, raml.Resources.First().Methods.Count()); }
public async Task ShouldLoad_WhenHasIncludes() { var ramlText = File.ReadAllText("congo-drones-5-f.raml"); var parser = new RamlParser(); var raml = await parser.LoadRamlAsync(ramlText); Assert.AreEqual(2, raml.Resources.Count()); }
public async Task ShouldLoad_WhenValidRAML() { var ramlText = File.ReadAllText("test.raml"); var parser = new RamlParser(); var raml = await parser.LoadRamlAsync(ramlText); Assert.AreEqual(2, raml.Resources.Count()); }
public async Task ShouldParse_Congo() { var parser = new RamlParser(); var raml = await parser.LoadAsync("congo-drones-5-f.raml"); Assert.AreEqual(2, raml.Resources.Count()); Assert.AreEqual(2, raml.Resources.First().Methods.Count()); }
public async Task ShouldLoad_WhenMaps() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/maps.raml"); Assert.AreEqual(4, raml.Types.Count); Assert.AreEqual(1, raml.Resources.Count()); }
public async Task ShouldLoad_WhenMovieType() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/movietype.raml"); Assert.AreEqual(1, raml.Types.Count); Assert.AreEqual(1, raml.Resources.Count()); }
public async Task ShouldParseCustomerAsObject() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/chinook-v1.raml"); Assert.AreEqual("Person", raml.Types["Customer"].Type); Assert.AreEqual("string", raml.Types["Customer"].Object.Properties["Company"].Type); }
public async Task ShouldLoadInlinedTypes() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/inlinetype.raml"); Assert.IsNotNull(raml.Resources.First().Methods.First().Responses.First().Body.First().Value.InlineType); Assert.IsNotNull(raml.Resources.First().Methods.Last().Body.First().Value.InlineType); }
public async Task ShouldLoad_WhenMoviesV1() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/movies-v1.raml"); Assert.AreEqual(2, raml.Resources.Count()); Assert.AreEqual(2, raml.Resources.First().Methods.Count()); }
public async Task ShouldLoad_WhenHasIncludes() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/XKCD/api.raml"); Assert.AreEqual(2, raml.Resources.Count); Assert.AreEqual(1, raml.Schemas.Count()); Assert.IsTrue(!string.IsNullOrWhiteSpace(raml.Schemas.First()["comic"])); }
public async Task ShouldReportErrors() { var parser = new RamlParser(); try { await parser.LoadAsync("Specifications/error-reporting.raml"); } catch (FormatException ex) { Assert.IsTrue(ex.Message.Contains("Error: Required property: lastname is missed")); Assert.IsTrue(ex.Message.Contains("Error: invalid media type")); } }
public async Task ShouldParseDisorderedTypes() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/typesordering.raml"); Assert.IsNotNull(model); Assert.AreEqual(11, model.Types.Count); Assert.IsNotNull(model.Types["employee"].Object); Assert.IsNotNull(model.Types["SupportRepresentant"].Object); }
public async Task ShouldHandleOverlay() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/librarybooks.raml", new[] {"Specifications/librarybooks-overlay.raml"}); Assert.AreEqual(2, raml.Documentation.Count()); Assert.AreEqual("El acceso automatizado a los libros", raml.Documentation.First().Content); Assert.AreEqual("Book Library API", raml.Title); Assert.AreEqual(1, raml.Resources.First().Methods.Count()); }
public async Task ShouldParseResourceTypes() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/resource-types.raml"); Assert.AreEqual(3, model.ResourceTypes.First().Values.First().Get.QueryParameters.Values.Count); Assert.AreEqual(1, model.ResourceTypes.First().Values.First().UriParameters.Count); }
public async Task ShouldParseRaml200Tutoriasl() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/raml08/raml-tutorial-200/jukebox-api.raml"); Assert.IsTrue(model.Resources.SelectMany(r => r.Methods).All(m => m.Is.Count() == 3)); Assert.IsTrue(model.Resources.SelectMany(r => r.Methods).SelectMany(m => m.Is).All(i => i == "searchable" || i == "orderable" || i == "pageable")); }
private static async Task<RamlDocument> Parse(string filePath) { parser = new RamlParser(); var fi = new FileInfo(filePath); var raml = await parser.LoadAsync(fi.FullName); return raml; }
public async Task ShouldLoad_WhenMovieType() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/movietype.raml"); Assert.AreEqual(1, raml.Types.Count); Assert.IsNotNull(raml.Types["Movie"].Example); Assert.AreEqual(1, raml.Resources.Count()); }
public async Task ShouldBuild_SalesOrder() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/salesOrders.raml"); Assert.AreEqual(18, raml.Types.Count); Assert.IsNotNull(raml.ResourceTypes.First(r=> r.ContainsKey("collectionResource"))["collectionResource"].Post.Body); Assert.IsNotNull(raml.ResourceTypes.First(r => r.ContainsKey("collectionResource"))["collectionResource"].Post.Body.Type); }
public async Task ShouldParseSalesOrders() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/salesOrders.raml"); Assert.AreEqual(18, model.Types.Count); Assert.IsNotNull(model.Types["salesOrderCollectionResponse"].Object); Assert.AreEqual(1, model.Types["salesOrderCollectionResponse"].Object.Properties.Count); }
public async Task ShouldHandleXmlExternal() { var parser = new RamlParser(); var raml = await parser.LoadAsync("Specifications/ordersXml-v1.raml"); Assert.AreEqual(2, raml.Types.Count); Assert.IsFalse(string.IsNullOrWhiteSpace(raml.Types["PurchaseOrderType"].External.Xml)); Assert.IsFalse(string.IsNullOrWhiteSpace(raml.Types["ItemsType"].External.Xml)); }
public async Task ShouldParseDateTypes() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/dates.raml"); Assert.AreEqual(3, model.Types.Count); Assert.AreEqual(3, model.Types["person"].Object.Properties.Count); Assert.AreEqual(2, model.Types["user"].Object.Properties.Count); Assert.AreEqual(2, model.Types["sample"].Object.Properties.Count); Assert.IsNotNull(model.Types["person"].Object.Properties.First(p => p.Key == "born").Value.Scalar); Assert.IsNotNull(model.Types["user"].Object.Properties.First(p => p.Key == "lastaccess").Value.Scalar); Assert.IsNotNull(model.Types["sample"].Object.Properties.First(p => p.Key == "prop1").Value.Scalar); Assert.IsNotNull(model.Types["sample"].Object.Properties.First(p => p.Key == "prop2").Value.Scalar); Assert.AreEqual("date-only", model.Types["person"].Object.Properties.First(p => p.Key == "born").Value.Scalar.Type); Assert.AreEqual("datetime", model.Types["user"].Object.Properties.First(p => p.Key == "lastaccess").Value.Scalar.Type); Assert.AreEqual("time-only", model.Types["sample"].Object.Properties.First(p => p.Key == "prop1").Value.Scalar.Type); Assert.AreEqual("datetime-only", model.Types["sample"].Object.Properties.First(p => p.Key == "prop2").Value.Scalar.Type); }
public async Task ShouldParseDependentTypes() { var parser = new RamlParser(); var model = await parser.LoadAsync("Specifications/dependentTypes.raml"); Assert.IsNotNull(model); Assert.AreEqual(2, model.Types.Count); }
public async Task ShouldThrowError_WhenInvalidRAML() { var parser = new RamlParser(); await parser.LoadAsync("invalid.raml"); }