private static TestCase TestCaseFromJson(ILogger logger, JObject testCaseJson)
        {
            string type;

            if (!JsonHelpers.TryGetString(testCaseJson, Constants.TCJsonType, out type))
            {
                throw new Exception("Test case json is missing required property `" + Constants.TCJsonType + "`.");
            }

            TestCase testCase = null;

            switch (type)
            {
            case Constants.TCJsonTypeInteractionDeviceTwin:
                testCase = DeviceTwinTestCase.FromJson(logger, testCaseJson);
                break;

            case Constants.TCJsonTypeInteractionDirectMethod:
                testCase = DirectMethodTestCase.FromJson(logger, testCaseJson);
                break;

            default:
                throw new Exception("Test case json type is unknown `" + type + "`.");
            }

            return(testCase);
        }
Beispiel #2
0
        private static TestCase TestCaseFromJson(ILogger logger, JObject testCaseJson)
        {
            string type;

            if (!JsonHelpers.TryGetString(testCaseJson, Constants.TCJsonType, out type))
            {
                return(null);
            }

            TestCase testCase = null;

            switch (type)
            {
            case Constants.TCJsonInteractionDeviceTwin:
                testCase = DeviceTwinTestCase.FromJson(logger, testCaseJson);
                break;

            case Constants.TCJsonInteractionDirectMethod:
                testCase = DirectMethodTestCase.FromJson(logger, testCaseJson);
                break;

            case Constants.TCJsonInteractionDotNetApi:
            {
                string dotNetApiName;
                if (JsonHelpers.TryGetString(testCaseJson, Constants.TCJsonDotNetApiName, out dotNetApiName))
                {
                    switch (dotNetApiName)
                    {
                    case Constants.TCJsonSetWindowsUpdateRingAsync:
                        // testCase = SetWindowsUpdateRingAsyncTestCase.FromJson(testCaseJson);
                        break;
                    }
                }
            }
            break;
            }

            return(testCase);
        }