public void UnregisteredModuleKeyLeadsToErrorOnPost() { Mock <IModuleSelector> moduleSelector = new Mock <IModuleSelector>(MockBehavior.Strict); moduleSelector.Setup(ms => ms.SelectModule("unregistered_module_key")).Returns((IModule)null); XmlDocument payload = new XmlDocument(); RoutingService sut = new RoutingService(moduleSelector.Object); Assert.Throws <ModuleNotRegisteredException>(() => sut.Post("some_query", payload, "unregistered_module_key")); }
public void ModuleIsInvokedOnPost() { Mock <IModuleSelector> moduleSelector = new Mock <IModuleSelector>(MockBehavior.Strict); Mock <IModule> module = new Mock <IModule>(MockBehavior.Loose); moduleSelector.Setup(ms => ms.SelectModule("some_module_key")).Returns(module.Object); XmlDocument payload = new XmlDocument(); RoutingService sut = new RoutingService(moduleSelector.Object); sut.Post("some_query", payload, "some_module_key"); module.Verify(m => m.Post("some_query", payload)); }