Example #1
0
        public void ScpdTest()
        {
            var controller = CreateServiceController();
            var root       = new DummyRoot(
                new DeviceType("schemas-upnp-org", "mono-upnp-tests-device", new Version(1, 0)),
                "uuid:d1",
                "Mono.Upnp.Tests Device",
                "Mono Project",
                "Device",
                new DeviceOptions {
                Services = new[] {
                    new Service(
                        new ServiceType("uschemas-upnp-org", "mono-upnp-test-service", new Version(1, 0)),
                        "urn:upnp-org:serviceId:testService1",
                        controller
                        )
                }
            }
                );

            using (var server = new Server(root)) {
                server.Start();
                var request = WebRequest.Create(new Uri(root.UrlBase, "/service/0/scpd/"));
                using (var response = (HttpWebResponse)request.GetResponse()) {
                    Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
                    using (var reader = XmlReader.Create(response.GetResponseStream())) {
                        var target_controller = deserializer.DeserializeServiceController(reader);
                        ServiceDescriptionTests.AssertEquality(controller, target_controller);
                    }
                }
            }
        }
Example #2
0
 public void ScpdTest ()
 {
     var controller = CreateServiceController ();
     var root = new DummyRoot (
         new DeviceType ("schemas-upnp-org", "mono-upnp-tests-device", new Version (1, 0)),
         "uuid:d1",
         "Mono.Upnp.Tests Device",
         "Mono Project",
         "Device",
         new DeviceOptions {
             Services = new[] {
                 new Service (
                     new ServiceType ("uschemas-upnp-org", "mono-upnp-test-service", new Version (1, 0)),
                     "urn:upnp-org:serviceId:testService1",
                     controller
                 )
             }
         }
     );
     using (var server = new Server (root)) {
         server.Start ();
         var request = WebRequest.Create (new Uri (root.UrlBase, "/service/0/scpd/"));
         using (var response = (HttpWebResponse)request.GetResponse ()) {
             Assert.AreEqual (HttpStatusCode.OK, response.StatusCode);
             using (var reader = XmlReader.Create (response.GetResponseStream ())) {
                 var target_controller = deserializer.DeserializeServiceController (reader);
                 ServiceDescriptionTests.AssertEquality (controller, target_controller);
             }
         }
     }
 }