Visaul Studio 2015: Code Lens Unit Test Attribution bug

I am currently working on a legacy application that has recently had a “solution” upgrade to work with Visual Studio 2015. During the course of my work I have encountered minor Code Lens attribution bug.

The bug essentially attributes test results of a child class, to the base class from which it is inherited. The test results are then propagated up the class hierarchy to all classes which inherit from the base class.

Example:

  1. Create Unit Tests for new Attribute Figure: Unit Tests for RemoteRequireAttribute Figure: Unit Tests for RemoteRequireAttribute

  2. Create ActionFilter that inherits from RequireHttpsAttribute | ActionFilterAttribute and implement functionality. Figure: RemoteRequireHttpsAttribute class signature Figure: RemoteRequireHttpsAttribute class signature

  3. Execute Tests. All Passing Figure: Passing Unit Tests Figure: Passing Unit Tests

  4. View another class that inherits from ActionAttribute. VS2015 Code lens now shows 5 of 5 tests passing. Figure: 5 of 5 passing tests Figure: 5 of 5 passing tests

  5. Closer inspection of the tests shows that the are not related to this class, other than the base inherited classes. Figure: 5 of 5 passing tests are all for RemoteRequireHttpsAttribute ActionFilter. Figure: 5 of 5 passing tests are all for RemoteRequireHttpsAttribute ActionFilter.

For those of you who are wondering what my system looks like:

About Jeremy

Jeremy is a Father of 3, Husband, overly opinionated Software Engineer and Professional Trouble Maker.

Jeremy is currently a Cephalopod at Octopus Deploy.
You can find him on Twitter and GitHub.