|
- <!-- #include file="../aspunit/Lib/ASPUnit.asp" -->
- <!-- #include file="../bootstrap.asp" -->
- <!-- #include file="../support/HttpCaptureHelpers.asp" -->
-
- <%
- Call ASPUnit.AddModule( _
- ASPUnit.CreateModule( _
- "Shared Layout Render Tests", _
- Array( _
- ASPUnit.CreateTest("HomePageIncludesSharedHeaderAssets"), _
- ASPUnit.CreateTest("HomePageUsesControllerTitleInLayout"), _
- ASPUnit.CreateTest("NotFoundPageStillIncludesSharedLayoutChrome") _
- ), _
- ASPUnit.CreateLifeCycle("SetupSharedLayout", "TeardownSharedLayout") _
- ) _
- )
-
- Call ASPUnit.Run()
-
- Sub SetupSharedLayout()
- Call ResetTestRuntime()
- End Sub
-
- Sub TeardownSharedLayout()
- Call ResetTestRuntime()
- End Sub
-
- Function HomePageIncludesSharedHeaderAssets()
- Dim responseData
- Dim body
-
- Set responseData = FetchPage("/")
- body = responseData.Item("body")
-
- Call ASPUnit.Ok((responseData.Item("status") = 200 And _
- InStr(body, "navbar-brand rk-navbar-brand") > 0 And _
- InStr(body, "/css/site.css") > 0 And _
- InStr(body, "bootstrap.bundle.min.js") > 0), _
- "Home page should include shared header and footer assets from the layout")
-
- Set responseData = Nothing
- End Function
-
- Function HomePageUsesControllerTitleInLayout()
- Dim responseData
- Set responseData = FetchPage("/")
-
- Call ASPUnit.Ok((InStr(LCase(responseData.Item("body")), "<title>home</title>") > 0), _
- "Home page layout should render the controller title in the <title> tag")
-
- Set responseData = Nothing
- End Function
-
- Function NotFoundPageStillIncludesSharedLayoutChrome()
- Dim responseData
- Dim body
-
- Set responseData = FetchPage("/404")
- body = responseData.Item("body")
-
- Call ASPUnit.Ok((responseData.Item("status") = 404 And _
- InStr(body, "404 - Page Not Found") > 0 And _
- InStr(body, "navbar-brand rk-navbar-brand") > 0 And _
- InStr(body, "bootstrap.bundle.min.js") > 0), _
- "404 page should still render inside the shared layout chrome")
-
- Set responseData = Nothing
- End Function
- %>
|