Example #1
0
 public void ParseInvalidJsonReplyWillThrowException()
 {
     HttpRequestSender provisionerService = new HttpRequestSender();
     provisionerService.ParseResponse("InvalidJson");
 }
Example #2
0
 public void HTTPRequestFailedWillThrowTimeoutException()
 {
     HttpRequestSender provisionerService = new HttpRequestSender();
     provisionerService.SendAsyncRequest("http://na.widespace.com", TestDelegateMethod3);
 }
Example #3
0
 public void SendRequestFuncWillThrowExceptionforInvalidUrl()
 {
     HttpRequestSender provisionerService = new HttpRequestSender();
     provisionerService.SendAsyncRequest("bla bla bla", TestDelegateMethod3);
 }
Example #4
0
 public void GetServiceURLWillReturnValidUrl()
 {
     HttpRequestSender provisionerService = new HttpRequestSender();
     string url = UnitTestUtilities.RunInstanceMethod(typeof(HttpRequestSender), "GetServiceURL", provisionerService, new object[] { }).ToString();
     Assert.IsTrue(Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute));
 }
Example #5
0
 public void ParseProvisioningResponseTest()
 {
     Provisioner provisioner = Provisioner.ProvisionerInstance;
     HttpRequestSender provisionerService = new HttpRequestSender();
     string json = "{\"sdkEnabled\":true,\"sessionInfo\":{\"key\":\"YN53u9z213mEgAJ\",\"keyIndex\":0}}";
     Dictionary<string, string> provisioningData = provisionerService.ParseResponse(json);
     string expectedKeyValue = "YN53u9z213mEgAJ";
     string actualKeyValue = string.Empty;
     provisioningData.TryGetValue("key", out actualKeyValue);
     Assert.AreEqual(expectedKeyValue, actualKeyValue);
 }