public void Test_ReadCommands() { string mockCaseHtml = new MockTestCaseCreator().CreateTestCase("open", "TestPage.aspx"); HtmlNodeCollection nodes = new TestCaseReader(mockCaseHtml).ReadCommands(); Assert.AreEqual(1, nodes.Count, "Invalid number of commands found."); }
public void Test_Convert_ToString_OpenCommand() { string mockCase = new MockTestCaseCreator().CreateTestCase("open", "TestPage.aspx"); TestCaseConverter converter = new TestCaseConverter(); converter.Load(mockCase); string cSharpCase = converter.Convert(); throw new Exception(cSharpCase); }
public void Test_ReadTestName() { string mockCaseHtml = new MockTestCaseCreator().CreateTestCase("open", "TestPage.aspx"); string testName = new TestCaseReader(mockCaseHtml).ReadName(); string expectedName = "TestCase"; Assert.AreEqual(expectedName, testName, "Didn't read expected name."); }
public void Test_ReadBaseUrl() { string mockCaseHtml = new MockTestCaseCreator().CreateTestCase("open", "TestPage.aspx"); string baseUrl = new TestCaseReader(mockCaseHtml).ReadBaseUrl(); string expectedUrl = "http://localhost/TestApp/"; Assert.AreEqual(expectedUrl, baseUrl, "Didn't read expected base URL."); }
public void Test_Translate_HtmlNode() { string target = "TestPage.html"; string testCaseHtml = new MockTestCaseCreator().CreateTestCase("open", target); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(testCaseHtml); HtmlNode node = doc.DocumentNode.SelectSingleNode("//html/body/table/tbody/tr"); Assert.IsNotNull(node, "Couldn't find test node."); TestCaseCommandTranslator translator = new TestCaseCommandTranslator(); string command = translator.Translate(node); string expectedCommand = "selenium.Open(\"" + target + "\");"; Assert.AreEqual(expectedCommand, command, "Didn't match expected."); }