예제 #1
0
        public void TestWebsocketEndpoint()
        {
            var expectedJson = @"{""uri"":""wss://example.com/ws"",""content-type"":""audio/l16;rate=16000"",""headers"":{""Bar"":""foo""},""type"":""websocket""}";
            var endpoint     = new WebsocketEndpoint
            {
                Uri         = "wss://example.com/ws",
                ContentType = "audio/l16;rate=16000",
                Headers     = new Foo {
                    Bar = "foo"
                }
            };

            Assert.Equal(expectedJson, JsonConvert.SerializeObject(endpoint));
        }
예제 #2
0
        public void TestNccoEndpoint()
        {
            var expected          = "{\"uri\":\"wss://www.example.com/ws\",\"content-type\":\"audio/l16;rate=16000\",\"headers\":{\"Bar\":\"bar\"},\"type\":\"websocket\"}";
            var websocketEndpoint = new WebsocketEndpoint
            {
                Uri     = "wss://www.example.com/ws",
                Headers = new Foo {
                    Bar = "bar"
                },
                ContentType = "audio/l16;rate=16000"
            };
            string json = JsonConvert.SerializeObject(websocketEndpoint,
                                                      Formatting.None, new JsonSerializerSettings {
                DefaultValueHandling = DefaultValueHandling.Ignore
            });

            Assert.AreEqual(expected, json);
        }