static async Task callType(Test currentTest, HTTPOperation op)
 {
     switch (op)
     {
         case HTTPOperation.GET:
             result = await RunGetAsync(currentTest.getOperation().getUri());
             currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
             break;
         case HTTPOperation.POST:
             result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());
             currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
             break;
         case HTTPOperation.PUT:
             result = await RunPutAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());
             currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
             break;
         case HTTPOperation.DELETE:
             result = await RunDeleteAsync(currentTest.getOperation().getUri());
             currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
             break;
         default:
             Console.WriteLine("Unrecognized HTTP Operation!");
             Console.WriteLine(currentTest.ToString());
             break;
     }
 }
Beispiel #2
0
        //TODOIF: Tweak console output to be a little clearer. Console is made redundant by logs, but it could be useful.
        static async Task testType(Test currentTest)
        {
            KeyValuePair <JObject, string> result;

            results.WriteLine("Raw test results:");
            switch (currentTest.ToString())
            {
            case "iCmd":
                result = await RunGetAsync(currentTest.getOperation().getUri());

                currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
                Console.WriteLine(result.Value + " Is the result of the iCmd test");
                results.WriteLine(result.ToString());
                break;

            case "DeviceScan":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
                Console.WriteLine(result.Value + "Is the result of the DeviceScan test");
                results.WriteLine(result.ToString());
                break;

            case "DeviceSetting":
                result = await RunGetAsync(currentTest.getOperation().getUri());

                currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
                Console.WriteLine(result.Value + " Is the result of the DeviceSetting test");
                results.WriteLine(result.ToString());
                break;

            case "DeviceBackup":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
                Console.WriteLine(result.Value + "Is the result of the DeviceBackup test");
                results.WriteLine(result.ToString());
                break;

            case "DeviceStatus":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result.Key.GetValue("StatusCode").ToString());
                Console.WriteLine(result.Value + "Is the result of the DeviceStatus test");
                results.WriteLine(result.ToString());
                break;

            default:
                Console.WriteLine("Unrecognized test type!");
                Console.WriteLine(currentTest.ToString());
                break;
            }
        }
Beispiel #3
0
        //TODO: Set up the different test types.
        static async Task testType(Test currentTest)
        {
            string result;

            switch (currentTest.ToString())
            {
            case "iCmd":
                result = await RunGetAsync(currentTest.getOperation().getUri());

                currentTest.setActualResult(result);
                Console.WriteLine(result + " Is the result of the iCmd test");
                break;

            case "DeviceScan":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result);
                Console.WriteLine(result + "Is the result of the DeviceScan test");
                break;

            case "DeviceSetting":
                result = await RunGetAsync(currentTest.getOperation().getUri());

                currentTest.setActualResult(result);
                Console.WriteLine(result + " Is the result of the DeviceSetting test");
                break;

            case "DeviceBackup":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result);
                Console.WriteLine(result + "Is the result of the DeviceBackup test");
                break;

            case "DeviceStatus":
                result = await RunPostAsync(currentTest.getOperation().getUri(), currentTest.getOperation().getJson());

                currentTest.setActualResult(result);
                Console.WriteLine(result + "Is the result of the DeviceStatus test");
                break;

            default:
                Console.WriteLine("Unrecognized test type!");
                Console.WriteLine(currentTest.ToString());
                break;
            }
        }