Esempio n. 1
0
        public void WebServerResponse_Constructor_ResponseIsNull_ThrowsArgumentNullException()
        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            var webServerResponse = new WebServerResponse(null);

            //------------Assert Results-------------------------
        }
Esempio n. 2
0
        public void WebServerResponse_Constructor_ResponseIsNotNull_PropertiesInitialized()
        {
            //------------Setup for test--------------------------
            var response = new HttpResponseMessage();

            //------------Execute Test---------------------------
            var webServerResponse = new WebServerResponse(response);

            //------------Assert Results-------------------------
            Assert.IsNotNull(webServerResponse.Response);
            Assert.AreSame(response, webServerResponse.Response);
        }
        public void WebServerResponse_Constructor_ResponseIsNotNull_PropertiesInitialized()
        {
            //------------Setup for test--------------------------
            var response = new HttpResponseMessage();
            response.RequestMessage = new HttpRequestMessage();

            //------------Execute Test---------------------------
            var webServerResponse = new WebServerResponse(response);

            //------------Assert Results-------------------------
            Assert.IsNotNull(webServerResponse.Response);
            var accessControlList = response.Headers.GetValues("Access-Control-Allow-Credentials").ToList();
            Assert.IsNotNull(accessControlList);
            Assert.AreEqual(1,accessControlList.Count);
            Assert.AreEqual("true",accessControlList[0]);
        }
Esempio n. 4
0
 public async Task <WebServerResponse> Get(string text, string floor)
 {
     if (string.IsNullOrEmpty(floor))
     {
         await _speechService.SayAsync(text, 0);
     }
     else if (floor.ToLower() == "up")
     {
         await _speechService.SayAsync(text, -1);
     }
     else
     {
         await _speechService.SayAsync(text, 1);
     }
     return(WebServerResponse.CreateOk("OK"));
 }
        public void WebServerResponse_Constructor_ResponseWithOrigin_PropertiesInitialized()
        {
            //------------Setup for test--------------------------
            var response = new HttpResponseMessage { RequestMessage = new HttpRequestMessage() };
            response.RequestMessage.Headers.Add("Origin","http://localhost");
            //------------Execute Test---------------------------
            var webServerResponse = new WebServerResponse(response);

            //------------Assert Results-------------------------
            Assert.IsNotNull(webServerResponse.Response);
            var accessControlList = response.Headers.GetValues("Access-Control-Allow-Credentials").ToList();
            var accessControlOrgins = response.Headers.GetValues("Access-Control-Allow-Origin").ToList();
            Assert.IsNotNull(accessControlList);
            Assert.AreEqual(1,accessControlList.Count);
            Assert.AreEqual("true",accessControlList[0]);
            Assert.IsNotNull(accessControlOrgins);
            Assert.AreEqual(1, accessControlOrgins.Count);
            Assert.AreEqual("http://localhost", accessControlOrgins[0]);
        }