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

            // Act
            BaseUriMappingParser.Parse(XDocument.Parse(Xml).Root);
        }
コード例 #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);
        }
コード例 #4
0
        public void TestParseWithNoItem()
        {
            // Arrange
            const string Xml = @"<BaseUriMapping />";

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

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