PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.Tests/Navigation/CustomPages.cs

#
C# | 53 lines | 46 code | 7 blank | 0 comment | 0 complexity | 0186ece57ffad21b2cc44d306b4f0a33 MD5 | raw file
 1using System;
 2using NUnit.Framework;
 3using BlogEngine.Tests.FileSystem;
 4
 5namespace BlogEngine.Tests.Navigation
 6{
 7    [TestFixture]
 8    class CustomPages : BeTest
 9    {
10        private static string TestFile = "";
11
12        [SetUp]
13        public void Init()
14        {
15            TestFile = "<%@ Page Language=\"C#\" %>" + Environment.NewLine;
16            TestFile += "<script runat=\"server\"></script>" + Environment.NewLine;
17            TestFile += "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + Environment.NewLine;
18            TestFile += "<head runat=\"server\"><title></title></head><body><form id=\"form1\" runat=\"server\"><div>This is a test ASPX page.</div></form></body></html>";
19        }
20
21        [Test]
22        public void CanNavigateToCustomAspxPage()
23        {
24            IO.MkFile("test.aspx", TestFile);
25            ie.GoTo(Constants.Root + "/test.aspx");
26            ie.WaitForComplete();
27            Assert.IsTrue(ie.ContainsText("This is a test ASPX page."));
28        }
29
30        [Test]
31        public void CanNavigateToDefaultAspxPageInSubDiretory()
32        {
33            IO.MkDir("User controls/test");
34            IO.MkFile("User controls/test/Default.aspx", TestFile);
35
36            ie.GoTo(Constants.Root + "/User controls/test/Default.aspx");
37            ie.WaitForComplete();
38            Assert.IsTrue(ie.ContainsText("This is a test ASPX page."));
39
40            ie.GoTo(Constants.Root + "/User controls/test/");
41            ie.WaitForComplete();
42            Assert.IsTrue(ie.ContainsText("This is a test ASPX page."));
43        }
44
45        [TearDown]
46        public void Dispose()
47        {
48            IO.DelFile("test.aspx");
49            IO.DelFile("User controls/test/Default.aspx");
50            IO.DelDir("User controls/test");
51        }
52    }
53}