private KeyValuePair <string, ITestCase> Deserialize(XunitTestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, string serialization) { var testCase = default(ITestCase); try { if (serialization.Length > 3 && serialization.StartsWith(":F:")) { // Format from TestCaseDescriptorFactory: ":F:{typeName}:{methodName}:{defaultMethodDisplay}" var parts = serialization.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length > 3) { var typeInfo = discoverer.AssemblyInfo.GetType(parts[1]); var testClass = discoverer.CreateTestClass(typeInfo); var methodInfo = testClass.Class.GetMethod(parts[2], true); var testMethod = new TestMethod(testClass, methodInfo); var defaultMethodDisplay = (TestMethodDisplay)int.Parse(parts[3]); testCase = new XunitTestCase(DiagnosticMessageSink, defaultMethodDisplay, testMethod); } } if (testCase == null) { testCase = executor.Deserialize(serialization); } return(new KeyValuePair <string, ITestCase>(testCase.UniqueID, testCase)); } catch (Exception ex) { return(new KeyValuePair <string, ITestCase>(ex.ToString(), null)); } }
static ITestCase Deserialize(LoggerHelper logger, ITestFrameworkExecutor executor, TestCase testCase) { try { return(executor.Deserialize(testCase.GetPropertyValue <string>(SerializedTestCaseProperty, null))); } catch (Exception ex) { logger.LogError("Unable to de-serialize test case {0}: {1}", testCase.DisplayName, ex); return(null); } }
private static KeyValuePair <string, ITestCase> Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, string serialization) { try { var testCase = executor.Deserialize(serialization); return(new KeyValuePair <string, ITestCase>(testCase.UniqueID, testCase)); } catch (Exception ex) { return(new KeyValuePair <string, ITestCase>($"Test case deserialization failure: {ex}", null)); } }
/// <inheritdoc/> public ITestCase Deserialize(string value) { return(executor.Deserialize(value)); }
/// <inheritdoc/> public List <KeyValuePair <string?, ITestCase?> > BulkDeserialize(List <string> serializations) => serializations .Select(serialization => executor.Deserialize(serialization)) .Select(testCase => new KeyValuePair <string?, ITestCase?>(testCase?.UniqueID, testCase)) .ToList();