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

# · C# · 53 lines · 46 code · 7 blank · 0 comment · 0 complexity · 0186ece57ffad21b2cc44d306b4f0a33 MD5 · raw file

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