/// <summary> /// Executes async tests /// </summary> public async Task <TestCases> TestAsync() { var testCases = TestCasesParser.Parse(new Parser().Parse(this.testCasesCsv)); await testCases.TestAsync(new HttpRequestService(BaseUriMappingParser.Parse(XElement.Parse(baseUriMappingXml)), userAgentMappingXml != null ? UserAgentMappingParser.Parse(XElement.Parse(userAgentMappingXml)) : null, proxyUri), ActualRequestHook, ExpectedRequestHook); return(testCases); }
public void TestParseWithInvalidName() { // Arrange const string Xml = @"<XXX />"; // Act BaseUriMappingParser.Parse(XDocument.Parse(Xml).Root); }
/// <summary> /// Executes async tests /// </summary> /// <param name="testCasesCsv">testCasesCsv parameter</param> /// <param name="baseUriMappingXml">baseUriMappingXml parameter</param> /// <param name="userAgentMappingXml">userAgentMappingXml parameter</param> /// <param name="proxyUri">proxyUri parameter</param> /// <returns>failed message. it returns null if tests are succeed.</returns> public static async Task <TestCases> TestAsync(string testCasesCsv, string baseUriMappingXml, string userAgentMappingXml, string proxyUri = null) { var testCases = TestCasesParser.Parse(new CsvParser().Parse(testCasesCsv)); await testCases.TestAsync( new HttpRequestService(BaseUriMappingParser.Parse(XElement.Parse(baseUriMappingXml)), userAgentMappingXml != null ? UserAgentMappingParser.Parse(XElement.Parse(userAgentMappingXml)) : null, proxyUri)); return(testCases); }
public void TestParseWithNoItem() { // Arrange const string Xml = @"<BaseUriMapping />"; // Act var result = BaseUriMappingParser.Parse(XDocument.Parse(Xml).Root); // Assert Assert.AreEqual(0, result.Count); }
public void TestParse() { // Arrange const string Xml = @"<BaseUriMapping> <Item Key='TargetSite'>yahoo.com</Item> <Item Key='ExpectedApi'>api.yahoo.com</Item> </BaseUriMapping>"; // Act var result = BaseUriMappingParser.Parse(XDocument.Parse(Xml).Root); // Assert Assert.AreEqual(2, result.Count); Assert.AreEqual("yahoo.com", result["TargetSite"]); Assert.AreEqual("api.yahoo.com", result["ExpectedApi"]); }