public void op_Download_AbsoluteUri()
        {
            var expected = new FileInfo("example.json").ReadToEnd();
            var actual   = JsonUriAttribute.Download("http://www.alan-dean.com/example.json").ReadToEnd();

            Assert.Equal(expected, actual);
        }
        public void op_GetData_MethodInfo_Types_whenParameterCountMismatch()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/one.json", "http://www.alan-dean.com/two.json");

            Assert.Throws <InvalidOperationException>(() => obj.GetData(GetType().GetMethod("usage"), new[] { typeof(JObject) }).ToList());
        }
        public void op_GetData_MethodInfo_Types_whenInvalidParameterType()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws <JsonReaderException>(() => obj.GetData(GetType().GetMethod("usage"), new[] { typeof(string) }).ToList());
        }
        public void op_GetData_MethodInfo_TypesNull()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws <ArgumentNullException>(() => obj.GetData(GetType().GetMethod("usage"), null).ToList());
        }
        public void op_GetData_MethodInfoNull_Types()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws <ArgumentNullException>(() => obj.GetData(null, new[] { typeof(JObject) }).ToList());
        }
 public void op_Download_AbsoluteUriNull()
 {
     Assert.Throws <ArgumentNullException>(() => JsonUriAttribute.Download(null));
 }
 public void op_Download_AbsoluteUriNotFound()
 {
     Assert.Throws <WebException>(() => JsonUriAttribute.Download("http://www.alan-dean.com/missing.json"));
 }
Esempio n. 8
0
        public void op_GetData_MethodInfo_Types_whenParameterCountMismatch()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/one.json", "http://www.alan-dean.com/two.json");

            Assert.Throws<InvalidOperationException>(() => obj.GetData(GetType().GetMethod("usage"), new[] { typeof(JObject) }).ToList());
        }
Esempio n. 9
0
        public void op_GetData_MethodInfo_Types_whenInvalidParameterType()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws<JsonReaderException>(() => obj.GetData(GetType().GetMethod("usage"), new[] { typeof(string) }).ToList());
        }
Esempio n. 10
0
        public void op_GetData_MethodInfo_TypesNull()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws<ArgumentNullException>(() => obj.GetData(GetType().GetMethod("usage"), null).ToList());
        }
Esempio n. 11
0
        public void op_GetData_MethodInfoNull_Types()
        {
            var obj = new JsonUriAttribute("http://www.alan-dean.com/example.json");

            Assert.Throws<ArgumentNullException>(() => obj.GetData(null, new[] { typeof(JObject) }).ToList());
        }