Consolidated ASP Classic MVC framework from best components
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

70 řádky
2.1KB

  1. <!-- #include file="../aspunit/Lib/ASPUnit.asp" -->
  2. <!-- #include file="../bootstrap.asp" -->
  3. <!-- #include file="../support/HttpCaptureHelpers.asp" -->
  4. <%
  5. Call ASPUnit.AddModule( _
  6. ASPUnit.CreateModule( _
  7. "Shared Layout Render Tests", _
  8. Array( _
  9. ASPUnit.CreateTest("HomePageIncludesSharedHeaderAssets"), _
  10. ASPUnit.CreateTest("HomePageUsesControllerTitleInLayout"), _
  11. ASPUnit.CreateTest("NotFoundPageStillIncludesSharedLayoutChrome") _
  12. ), _
  13. ASPUnit.CreateLifeCycle("SetupSharedLayout", "TeardownSharedLayout") _
  14. ) _
  15. )
  16. Call ASPUnit.Run()
  17. Sub SetupSharedLayout()
  18. Call ResetTestRuntime()
  19. End Sub
  20. Sub TeardownSharedLayout()
  21. Call ResetTestRuntime()
  22. End Sub
  23. Function HomePageIncludesSharedHeaderAssets()
  24. Dim responseData
  25. Dim body
  26. Set responseData = FetchPage("/")
  27. body = responseData.Item("body")
  28. Call ASPUnit.Ok((responseData.Item("status") = 200 And _
  29. InStr(body, "navbar-brand rk-navbar-brand") > 0 And _
  30. InStr(body, "/css/site.css") > 0 And _
  31. InStr(body, "bootstrap.bundle.min.js") > 0), _
  32. "Home page should include shared header and footer assets from the layout")
  33. Set responseData = Nothing
  34. End Function
  35. Function HomePageUsesControllerTitleInLayout()
  36. Dim responseData
  37. Set responseData = FetchPage("/")
  38. Call ASPUnit.Ok((InStr(LCase(responseData.Item("body")), "<title>home</title>") > 0), _
  39. "Home page layout should render the controller title in the <title> tag")
  40. Set responseData = Nothing
  41. End Function
  42. Function NotFoundPageStillIncludesSharedLayoutChrome()
  43. Dim responseData
  44. Dim body
  45. Set responseData = FetchPage("/404")
  46. body = responseData.Item("body")
  47. Call ASPUnit.Ok((responseData.Item("status") = 404 And _
  48. InStr(body, "404 - Page Not Found") > 0 And _
  49. InStr(body, "navbar-brand rk-navbar-brand") > 0 And _
  50. InStr(body, "bootstrap.bundle.min.js") > 0), _
  51. "404 page should still render inside the shared layout chrome")
  52. Set responseData = Nothing
  53. End Function
  54. %>

Powered by TurnKey Linux.