public static RamlData GetRamlData(string ramlSource, string targetNamespace)
        {
            try
            {
                var ramlInfo = RamlInfoService.GetRamlInfo(ramlSource);

                if (ramlInfo.HasErrors)
                {
                    MessageBox.Show(ramlInfo.ErrorMessage);
                    return null;
                }

                var model = new WebApiGeneratorService(ramlInfo.RamlDocument).BuildModel();
                var filename = Path.GetFileName(ramlSource);
                if (string.IsNullOrWhiteSpace(filename))
                    filename = "source.raml";

                return new RamlData ( model, ramlInfo.RamlContents, filename);
            }
            catch (Exception ex)
            {
                ActivityLog.LogError(VisualStudioAutomationHelper.RamlVsToolsActivityLogSource,
                    VisualStudioAutomationHelper.GetExceptionInfo(ex));
                var errorMessage = ex.Message;
                if (ex.InnerException != null)
                    errorMessage += " - " + ex.InnerException.Message;

                MessageBox.Show(errorMessage);
                return null;
            }
        }
        private static async Task<WebApiGeneratorModel> GetIssue37GeneratedModel()
        {
            var raml = await new RamlParser().LoadAsync("files/issue37.raml");
            var model = new WebApiGeneratorService(raml, "TargetNamespace").BuildModel();

            return model;
        }
        private static async Task<WebApiGeneratorModel> GetAdditionalPropertiesGeneratedModel()
        {
            var raml = await new RamlParser().LoadAsync("files/additionalprops.raml");
            var model = new WebApiGeneratorService(raml, "TargetNamespace").BuildModel();

            return model;
        }
        private static async Task<WebApiGeneratorModel> GetOrdersXmlGeneratedModel()
        {
            var raml = await new RamlParser().LoadAsync("files/ordersXml.raml");
            var model = new WebApiGeneratorService(raml, "OrdersXml").BuildModel();

            return model;
        }
		private static async Task<WebApiGeneratorModel> GetSchemaTestsGeneratedModel()
		{
			var raml = await new RamlParser().LoadAsync("files/schematests.raml");
            var model = new WebApiGeneratorService(raml, "TestNs").BuildModel();

            return model;
        }
        private async Task<WebApiGeneratorModel> GetRegressionGeneratedModel()
        {
            var raml = await new RamlParser().LoadAsync("files/regression.raml");

            var model = new WebApiGeneratorService(raml, "TestNs").BuildModel();
			return model;
		}
        public void Should_Inherit_Uri_Parameters_When_Nested_Resources_Case2()
        {
            var doc = new RamlDocument { Title = "test" };

            var uriParameters1 = new Dictionary<string, Parameter>
                                {
                                    {
                                        "id", new Parameter
                                                {
                                                    DisplayName = "id",
                                                    Type = "integer"
                                                }
                                    }
                                };

            var uriParameters2 = new Dictionary<string, Parameter>
                                {
                                    {
                                        "current", new Parameter
                                                 {
                                                     DisplayName = "current",
                                                     Type = "boolean"
                                                 }
                                    }
                                };

            var methods = new List<Method>
                          {
                              new Method
                              {
                                  Verb = "get"
                              }
                          };

            var resources = new Collection<Resource>
            {
                new Resource
                {
                    RelativeUri = "/{id}",
                    Methods = methods,
                    UriParameters = uriParameters1,
                    Resources = new Collection<Resource>
                    {
                        new Resource
                        {
                            RelativeUri = "/something",
                            Methods = methods,
                            Resources = new Collection<Resource>
                            {
                                new Resource
                                {
                                    RelativeUri = "/{current}",
                                    Methods = methods,
                                    UriParameters = uriParameters2,
                                    Resources = new Collection<Resource>
                                    {
                                        new Resource
                                        {
                                            RelativeUri = "/deep",
                                            Methods = methods
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
            };

            doc.Resources = resources;

            var service = new WebApiGeneratorService(doc, "TargetNamespace");
            var model = service.BuildModel();
            Assert.AreEqual("bool", model.Controllers.First().Methods.First(m => m.Name.Contains("Deep")).UriParameters.First(p => p.Name == "current").Type);
            Assert.AreEqual("int", model.Controllers.First().Methods.First(m => m.Name.Contains("Deep")).UriParameters.First(p => p.Name == "id").Type);
        }
		private static async Task<WebApiGeneratorModel> GetMoviesGeneratedModel()
		{
			var raml = await new RamlParser().LoadAsync("files/movies.raml");
			var model = new WebApiGeneratorService(raml).BuildModel();

			return model;
		}
		private async Task<WebApiGeneratorModel> GetLargeGeneratedModel()
		{
			var raml = await new RamlParser().LoadAsync("files/large.raml");

			var model = new WebApiGeneratorService(raml).BuildModel();
			return model;
		}
 public async Task ShouldAccept3LevelNestingVersion3Schema_()
 {
     var raml = await new RamlParser().LoadAsync("files/level3nest-v3.raml");
     var model = new WebApiGeneratorService(raml, "TestNs").BuildModel();
     Assert.AreEqual(4, model.Objects.Count());
 }