public void ShouldAssignIdIfPresentInParameters() { var request = CreateRequestContext("NamingConvention", "method_requires_id", "POST", id: "34"); var adapter = new NamingConventionAdapter(); _methodInvoker.InvokeAdapterMethod(request, adapter); Assert.IsTrue(adapter.WasMethodCalled(a => a.method_requires_id(34, new {}))); }
public void ShouldCallCorrectMethodOverloadBasedOnHttpVerb() { var request = CreateRequestContext("NamingConvention", "name_with_underscores", "POST"); var adapter = new NamingConventionAdapter(); _methodInvoker.InvokeAdapterMethod(request, adapter); Assert.IsTrue(adapter.WasMethodCalled(a => a.name_with_underscores(new { }))); }
public void ShouldInferMethodNameFromPath() { var request = CreateRequestContext("NamingConvention", "name_with_underscores"); var adapter = new NamingConventionAdapter(); _methodInvoker.InvokeAdapterMethod(request, adapter); Assert.IsTrue(adapter.WasMethodCalled(a => a.name_with_underscores())); }
public void ShouldCallMethodWithCorrectParameters() { var request = CreateRequestContext("NamingConvention", "name_with_underscores", query: "id=123&provider=fake&project=myProj"); var adapter = new NamingConventionAdapter(); _methodInvoker.InvokeAdapterMethod(request, adapter); Assert.IsTrue(adapter.WasMethodCalled( a => a.name_with_underscores(123, "fake", "myProj"))); }
private void ConfirmMethodIsCalledForHttpVerbByNamingConvention(String httpVerb, String methodName, Expression<Action<NamingConventionAdapter>> expectedMethod) { var request = CreateRequestContext("NamingConvention", methodName, httpVerb); var adapter = new NamingConventionAdapter(); _methodInvoker.InvokeAdapterMethod(request, adapter); Assert.IsTrue(adapter.WasMethodCalled(expectedMethod), "Expected method {0}{1} to be called", httpVerb, methodName); }