public void FailureSamplesTest(string template, string[] results, TestSet.TestCase testCase) { var uriTemplate = new UriTemplate(template); foreach (var variable in testCase.TestSet.Variables) { uriTemplate.SetParameter(variable.Key, variable.Value); } string result = null; ArgumentException aex = null; try { result = uriTemplate.Resolve(); } catch (ArgumentException ex) { aex = ex; } if (results[0] == "False") { Assert.NotNull(aex); } else { Assert.Contains(results, x => x == result); } }
public void SpecSamplesTest(string template, string[] results, TestSet.TestCase testCase) { var uriTemplate = new UriTemplate(template); foreach (var variable in testCase.TestSet.Variables) { uriTemplate.SetParameter(variable.Key, variable.Value); } string result = null; result = uriTemplate.Resolve(); Assert.Contains(results, x => x == result); }
private static TestSet.TestCase CreateTestCase(TestSet testSet, JToken testcase) { var testCase = new TestSet.TestCase(testSet); testCase.Template = testcase[0].Value <string>(); if (testcase[1].Type == JTokenType.Array) { var results = (JArray)testcase[1]; testCase.Result = results.Select(jv => jv.Value <string>()).ToArray(); } else { testCase.Result = new string[1]; testCase.Result[0] = testcase[1].Value <string>(); } return(testCase); }
private static TestSet.TestCase CreateTestCase(TestSet testSet, JToken testcase) { var testCase = new TestSet.TestCase(testSet); testCase.Template = testcase[0].Value<string>(); if (testcase[1].Type == JTokenType.Array) { var results = (JArray)testcase[1]; testCase.Result = results.Select(jv => jv.Value<string>()).ToArray(); } else { testCase.Result = new string[1]; testCase.Result[0] = testcase[1].Value<string>(); } return testCase; }