public void ShouldExecute_Dispose_Correctly() { var host = new UtilityHost(); CreateApplication(); eventFired = false; host.Init(application); WebCoreEvents.Instance.HostStop += Instance_Fired; host.Dispose(); WebCoreEvents.Instance.HostStop -= Instance_Fired; Assert.IsTrue(eventFired); }
public void ShouldExecute_Init_Correctly() { eventFired = false; var routesRegistered = false; using (var fakeProvider = new ContextScopeProviderHelper()) { var registration = new Mock<IWebModulesRegistration>(); registration .Setup(r => r.RegisterKnownModuleRoutes(It.IsAny<RouteCollection>())) .Callback<RouteCollection>(rc => routesRegistered = true); fakeProvider.RegisterFakeServiceInstance(registration.Object, typeof (IWebModulesRegistration)); var host = new UtilityHost(); CreateApplication(); WebCoreEvents.Instance.HostStart += Instance_Fired; host.Init(application); WebCoreEvents.Instance.HostStart -= Instance_Fired; } Assert.IsTrue(eventFired); Assert.IsTrue(routesRegistered); }