Exemple #1
0
        /// <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);
        }
Exemple #2
0
        public void TestParseWithInvalidName()
        {
            // Arrange
            const string Xml = @"<XXX />";

            // Act
            UserAgentMappingParser.Parse(XDocument.Parse(Xml).Root);
        }
Exemple #3
0
        /// <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);
        }
Exemple #4
0
        public void TestParseWithNoItem()
        {
            // Arrange
            const string Xml = @"<UserAgentMapping />";

            // Act
            var result = UserAgentMappingParser.Parse(XDocument.Parse(Xml).Root);

            // Assert
            Assert.AreEqual(0, result.Count);
        }
Exemple #5
0
        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"]);
        }