Esempio n. 1
0
        public void JsonFileValidator_Validate_returns_Invalid()
        {
            var jfv   = new JsonFileHandler();
            var bytes = Encoding.UTF8.GetBytes("bad json");

            jfv.Validate(bytes, "json", null).ShouldBe(FileStatusCode.Invalid);
        }
Esempio n. 2
0
        public void JsonFileValidator_Validate_returns_Valid(int i)
        {
            var arrayJson  = "[{\"key1\":\"value1\"},{\"key2\":\"value2\"},{\"key3\":\"value3\"},{\"key4\":\"value4\"}]";
            var simpleJson = "{\"data\":{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}}";

            var jsonArr = new[] { arrayJson, simpleJson };
            var bytes   = Encoding.UTF8.GetBytes(jsonArr[i]);

            var jfv = new JsonFileHandler();

            jfv.Validate(bytes, "json", null).ShouldBe(FileStatusCode.Valid);
        }
Esempio n. 3
0
        public void JsonFileValidator_Validate_returns_UnSupported()
        {
            var jfv = new JsonFileHandler();

            jfv.Validate(null, "fff", null).ShouldBe(FileStatusCode.Unsupported);
        }