Sub Test_HomeController_ServiceSummaryListsRegisteredServices() Dim app Dim controller Set app = New App app.RegisterInstance "clockService", New FakeService app.RegisterInstance "widgetService", New FakeService Set controller = New HomeController controller.Init app, Nothing controller.Execute AssertEquals "clockService, widgetService", controller.ServiceSummary, "ServiceSummary should comma-join registered service names in registration order" End Sub Sub Test_HomeController_ServiceSummaryWhenNoneRegistered() Dim app Dim controller Set app = New App Set controller = New HomeController controller.Init app, Nothing controller.Execute AssertEquals "None", controller.ServiceSummary, "ServiceSummary should say 'None' when nothing is registered" End Sub Sub Test_GreetController_UsesCapturedNameParam() Dim app Dim controller Dim params Set app = New App Set params = CreateObject("Scripting.Dictionary") params.Add "name", "Ada" Set controller = New GreetController controller.Init app, params controller.Execute AssertEquals "Ada", controller.Name, "GreetController should use the captured 'name' param" End Sub Sub Test_GreetController_DefaultsNameWhenMissing() Dim app Dim controller Dim params Set app = New App Set params = CreateObject("Scripting.Dictionary") Set controller = New GreetController controller.Init app, params controller.Execute AssertEquals "there", controller.Name, "GreetController should default to 'there' when no name was captured" End Sub Sub Test_GreetController_DefaultsNameWhenParamsIsNothing() Dim app Dim controller Set app = New App Set controller = New GreetController controller.Init app, Nothing controller.Execute AssertEquals "there", controller.Name, "GreetController should tolerate routeParams being Nothing" End Sub Sub Test_GreetController_CapturesOptionalIdParam() Dim app Dim controller Dim params Set app = New App Set params = CreateObject("Scripting.Dictionary") params.Add "name", "Ada" params.Add "id", "42" Set controller = New GreetController controller.Init app, params controller.Execute AssertTrue controller.HasId, "HasId should be True when the route captured an 'id'" AssertEquals "42", controller.Id, "GreetController should expose the captured 'id' param" End Sub Sub Test_GreetController_HasIdFalseWhenIdMissing() Dim app Dim controller Dim params Set app = New App Set params = CreateObject("Scripting.Dictionary") params.Add "name", "Ada" Set controller = New GreetController controller.Init app, params controller.Execute AssertFalse controller.HasId, "HasId should be False when the route did not capture an 'id'" End Sub Sub Test_NotFoundController_SetsResponseStatus() Dim app Dim controller Set app = New App Response.Status = "200 OK" Set controller = New NotFoundController controller.Init app, Nothing controller.Execute AssertEquals "404 Not Found", Response.Status, "NotFoundController should set a 404 status" End Sub RunTest "HomeController: ServiceSummary lists registered services", "Test_HomeController_ServiceSummaryListsRegisteredServices" RunTest "HomeController: ServiceSummary says 'None' when empty", "Test_HomeController_ServiceSummaryWhenNoneRegistered" RunTest "GreetController: uses captured name param", "Test_GreetController_UsesCapturedNameParam" RunTest "GreetController: defaults name when missing", "Test_GreetController_DefaultsNameWhenMissing" RunTest "GreetController: defaults name when params is Nothing", "Test_GreetController_DefaultsNameWhenParamsIsNothing" RunTest "GreetController: captures optional id param", "Test_GreetController_CapturesOptionalIdParam" RunTest "GreetController: HasId is False when id is missing", "Test_GreetController_HasIdFalseWhenIdMissing" RunTest "NotFoundController: sets 404 response status", "Test_NotFoundController_SetsResponseStatus"