<!-- #include file="../aspunit/Lib/ASPUnit.asp" -->
<!-- #include file="../bootstrap.asp" -->

<%
Call ASPUnit.AddModule( _
    ASPUnit.CreateModule( _
        "Config Integration Tests", _
        Array( _
            ASPUnit.CreateTest("NestedTestPageReadsMirroredConfigValue"), _
            ASPUnit.CreateTest("MissingConfigKeyReturnsNothingSentinel"), _
            ASPUnit.CreateTest("ProductionAppBaseUrlSupportsBlankOrConfiguredValue") _
        ), _
        ASPUnit.CreateLifeCycle("SetupConfigIntegration", "TeardownConfigIntegration") _
    ) _
)

Call ASPUnit.Run()

Sub SetupConfigIntegration()
    Call ResetTestRuntime()
End Sub

Sub TeardownConfigIntegration()
    Call ResetTestRuntime()
End Sub

Function NestedTestPageReadsMirroredConfigValue()
    Call ASPUnit.Equal(GetAppSetting("Error404RedirectSeconds"), "5", "Nested integration pages should read mirrored config values from their local web.config")
End Function

Function MissingConfigKeyReturnsNothingSentinel()
    Call ASPUnit.Equal(GetAppSetting("DefinitelyMissingSetting"), "nothing", "Missing config keys should return the existing nothing sentinel")
End Function

Function ProductionAppBaseUrlSupportsBlankOrConfiguredValue()
    Dim configuredUrl
    configuredUrl = GetAppSetting("ProductionAppBaseUrl")

    Call ASPUnit.Ok((configuredUrl = "" Or configuredUrl = "nothing" Or InStr(configuredUrl, "http://") = 1 Or InStr(configuredUrl, "https://") = 1), "ProductionAppBaseUrl should be either blank for host fallback or an explicit absolute URL")
End Function
%>
