Today I have stumbled onto an interesting problem: I had unit tests for my Node.JS project in Project A, but after I have moved the file (simple drag&drop in Visual Studio) to Project B, the unit tests were no longer showing up in the Test Explorer window.
There were no "build" errors, nothing, Visual Studio just wasn't discovering them anymore.
So and it has turned out that after the Drag&Drop operation one of the file properties was not preserved: TestFramework. In my case I just had to set it to ExportRunner.
Changing that did the trick :)
Sunday, October 23, 2016
Friday, May 13, 2016
Web API Attribute Routing - not as attribute-driven as one would expect
This is a short, but rather important note: when you call MapHttpAttributeRoutes() to configure routing based on attributes, Web API engine looks only for classes which name ends with *Controller.
This seems to be a carryover from convention-based routing, and it is rather unexpected that it is still there.
But if you are like me, and WebAPI came into your world just now, you would not really have that habit of naming all controllers like that, especially in the test project.
Summary: Always follow this pattern for WebAPI controller names: {Name}Controller.
And inherit from ApiController, but that's obvious.
This seems to be a carryover from convention-based routing, and it is rather unexpected that it is still there.
But if you are like me, and WebAPI came into your world just now, you would not really have that habit of naming all controllers like that, especially in the test project.
Summary: Always follow this pattern for WebAPI controller names: {Name}Controller.
And inherit from ApiController, but that's obvious.
Subscribe to:
Posts (Atom)