Ejemplo n.º 1
0
        public void TestGetCompletionItemsFromSchema()
        {
            var schema = JObject.Parse(@"
{
  ""$schema"": ""http://json-schema.org/draft-04/schema#"",
  ""title"": ""Build Schema"",
  ""definitions"": {
    ""build"": {
      ""type"": ""object"",
      ""properties"": {
        ""NoLogo"": {
          ""type"": ""boolean"",
          ""description"": ""Disables displaying the NUKE logo""
        },
        ""Configuration"": {
          ""type"": ""string"",
          ""description"": ""Configuration to build - Default is 'Debug' (local) or 'Release' (server)"",
          ""enum"": [
            ""Debug"",
            ""Release""
          ]
        },
        ""Target"": {
          ""type"": ""array"",
          ""description"": ""List of targets to be invoked. Default is '{default_target}'"",
          ""items"": {
            ""type"": ""string"",
            ""enum"": [
              ""Restore"",
              ""Compile""
            ]
          }
        }
      }
    }
  }
}
");
            var items  = SchemaUtility.GetCompletionItemsForBuildSchema(schema);

            items.Should().BeEquivalentTo(
                new Dictionary <string, string[]>
            {
                ["NoLogo"]        = null,
                ["Configuration"] = new[] { "Debug", "Release" },
                ["Target"]        = new[] { "Restore", "Compile" }
            });
        }