/// <summary> /// Executes tests /// </summary> /// <returns>failed message. it returns null if tests are succeed.</returns> public TestCases Test() { var testCases = TestCasesParser.Parse(new Parser().Parse(this.testCasesCsv)); testCases.Test(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 UserAgentMappingParser.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 = @"<UserAgentMapping />"; // Act var result = UserAgentMappingParser.Parse(XDocument.Parse(Xml).Root); // Assert Assert.AreEqual(0, result.Count); }
public void TestParse() { // Arrange const string Xml = @"<UserAgentMapping> <Item Key='IE11'>Mozilla IE11</Item> <Item Key='IE10'>Mozilla IE10</Item> </UserAgentMapping>"; // Act var result = UserAgentMappingParser.Parse(XDocument.Parse(Xml).Root); // Assert Assert.AreEqual(2, result.Count); Assert.AreEqual("Mozilla IE11", result["IE11"]); Assert.AreEqual("Mozilla IE10", result["IE10"]); }