예제 #1
0
        public void AddRequiredWithTwoValuesWhenSecondPropertyDoesntExist()
        {
            JsonSchema jsonSchema = new JsonSchema();

            jsonSchema.AddProperty("a", new JsonSchema());
            Assert.Throws <ArgumentException>(() => { jsonSchema.AddRequired("a", "b"); });
        }
예제 #2
0
 public void AddRequiredWithOneValueWhenPropertyDoesntExist()
 {
     JsonSchema jsonSchema = new JsonSchema();
     Assert.Throws<ArgumentException>(() => { jsonSchema.AddRequired("a"); });
     Assert.Null(jsonSchema.Properties);
     Assert.Null(jsonSchema.Required);
 }
예제 #3
0
        public void AddRequiredWithOneValueWhenPropertyDoesntExist()
        {
            JsonSchema jsonSchema = new JsonSchema();

            Assert.Throws <ArgumentException>(() => { jsonSchema.AddRequired("a"); });
            Assert.Null(jsonSchema.Properties);
            Assert.Null(jsonSchema.Required);
        }
예제 #4
0
        public void AddRequiredWithThreeValuesWhenAllPropertiesExist()
        {
            JsonSchema jsonSchema = new JsonSchema();
            jsonSchema.AddProperty("a", new JsonSchema());
            jsonSchema.AddProperty("b", new JsonSchema());
            jsonSchema.AddProperty("c", new JsonSchema());

            jsonSchema.AddRequired("a", "b", "c");

            Assert.Equal(new List<string>() { "a", "b", "c" }, jsonSchema.Required);
        }
예제 #5
0
        public void AddRequiredWithThreeValuesWhenAllPropertiesExist()
        {
            JsonSchema jsonSchema = new JsonSchema();

            jsonSchema.AddProperty("a", new JsonSchema());
            jsonSchema.AddProperty("b", new JsonSchema());
            jsonSchema.AddProperty("c", new JsonSchema());

            jsonSchema.AddRequired("a", "b", "c");

            Assert.Equal(new List <string>()
            {
                "a", "b", "c"
            }, jsonSchema.Required);
        }
예제 #6
0
 public void AddRequiredWithTwoValuesWhenSecondPropertyDoesntExist()
 {
     JsonSchema jsonSchema = new JsonSchema();
     jsonSchema.AddProperty("a", new JsonSchema());
     Assert.Throws<ArgumentException>(() => { jsonSchema.AddRequired("a", "b"); });
 }