public void RetrieveHandlerReturnsNullIfNotFound() { try { var expected = InitialiseMockHandler("testAction"); ActionHandlerFactory.Default.ActionHandlers.Add(expected); var controller = new DynamicController(); var actual = controller.RetrieveHandler("garbage"); Assert.That(actual, Is.Null); } finally { ActionHandlerFactory.Reset(); } }
public void RetrieveHandlerRetrievesAHandlerIfItExists() { var actionName = "testAction"; try { var expected = InitialiseMockHandler(actionName); ActionHandlerFactory.Default.ActionHandlers.Add(expected); var controller = new DynamicController(); var actual = controller.RetrieveHandler(actionName); Assert.That(actual, Is.SameAs(expected)); } finally { ActionHandlerFactory.Reset(); } }
public void RetrieveHandlerIgnoresCase() { var actionName = "testAction"; try { var expected = InitialiseMockHandler(actionName); ActionHandlerFactory.Default.ActionHandlers.Add(expected); var controller = new DynamicController(); var actual = controller.RetrieveHandler(actionName.ToUpperInvariant()); Assert.That(actual, Is.SameAs(expected)); } finally { ActionHandlerFactory.Reset(); } }