Exemplo n.º 1
0
        public void CanGetSampleResourceList()
        {
            Discoverator discoverator = new Discoverator();


            Stream       stream = discoverator.GetServices(_TestDomain);
            StreamReader reader = new StreamReader(stream);
            string       str    = reader.ReadToEnd();

            Assert.IsFalse(string.IsNullOrEmpty(str));

            var obj = JObject.Parse(str);

            Assert.AreEqual("1.2", obj["swaggerVersion"]);
            Assert.AreEqual("1.0.0.0", obj["apiVersion"]);
            Assert.IsTrue(obj["apis"].HasValues);

            var api1 = obj["apis"].Children().FirstOrDefault(o => o["path"].Value <string>().Equals("/v1/rest"));

            Assert.IsNotNull(api1);
            Assert.AreEqual("A RESTful WCF Service", api1["description"]);

            var api2 = obj["apis"].Children().FirstOrDefault(o => o["path"].Value <string>().Equals("/SecondaryService.svc"));

            Assert.IsNotNull(api2);
            Assert.AreEqual("Another endpoint", api2["description"]);
        }
        public void CanGetEmptyResourceList()
        {
            Discoverator discoverator = new Discoverator();

            Stream stream = discoverator.GetServices(_EmptyDomain);
            StreamReader reader = new StreamReader(stream);
            string str = reader.ReadToEnd();
            Assert.IsFalse(string.IsNullOrEmpty(str));

            var obj = JObject.Parse(str);
            Assert.AreEqual("1.2", obj["swaggerVersion"]);
            Assert.AreEqual("No Swaggerized assemblies.", obj["apiVersion"]);
            Assert.IsNull(obj["basePath"]);
            Assert.IsFalse(obj["apis"].HasValues);
        }
Exemplo n.º 3
0
        public void CanGetEmptyResourceList()
        {
            Discoverator discoverator = new Discoverator();

            Stream       stream = discoverator.GetServices(_EmptyDomain);
            StreamReader reader = new StreamReader(stream);
            string       str    = reader.ReadToEnd();

            Assert.IsFalse(string.IsNullOrEmpty(str));

            var obj = JObject.Parse(str);

            Assert.AreEqual("1.2", obj["swaggerVersion"]);
            Assert.AreEqual("No Swaggerized assemblies.", obj["apiVersion"]);
            Assert.IsNull(obj["basePath"]);
            Assert.IsFalse(obj["apis"].HasValues);
        }
        public void CanGetSampleResourceList()
        {
            Discoverator discoverator = new Discoverator();

            Stream stream = discoverator.GetServices(_TestDomain);
            StreamReader reader = new StreamReader(stream);
            string str = reader.ReadToEnd();
            Assert.IsFalse(string.IsNullOrEmpty(str));

            var obj = JObject.Parse(str);
            Assert.AreEqual("1.2", obj["swaggerVersion"]);
            Assert.AreEqual("1.0.0.0", obj["apiVersion"]);
            Assert.IsTrue(obj["apis"].HasValues);

            var api1 = obj["apis"].Children().FirstOrDefault(o => o["path"].Value<string>().Equals("/v1/rest"));
            Assert.IsNotNull(api1);
            Assert.AreEqual("A RESTful WCF Service", api1["description"]);

            var api2 = obj["apis"].Children().FirstOrDefault(o => o["path"].Value<string>().Equals("/SecondaryService.svc"));
            Assert.IsNotNull(api2);
            Assert.AreEqual("Another endpoint", api2["description"]);
        }