Example #1
0
        public void TestCoapClient_Discover()
        {
            Uri        uri    = new Uri($"coap://localhost:{_serverPort}/");
            CoapClient client = new CoapClient(uri);

            IEnumerable <WebLink> resources = client.Discover();

            Assert.AreEqual(4, resources.Count());

            resources = client.Discover(MediaType.ApplicationLinkFormat);
            Assert.AreEqual(4, resources.Count());
        }
Example #2
0
        public void TestCoapClient_UriPath()
        {
            Uri        uri    = new Uri("coap://localhost:" + _serverPort + "/");
            CoapClient client = new CoapClient(uri);

            IEnumerable <WebLink> resources = client.Discover();

            Assert.AreEqual(4, resources.Count());

            client.UriPath = "abc";

            Response r = client.Get();

            Assert.AreEqual("/abc", r.PayloadString);

            client.UriPath = "/abc/def";
            r = client.Get();
            Assert.AreEqual("/abc/def", r.PayloadString);
        }