SimpleStubs
SimpleStubs copied to clipboard
Unused using directive when exculding interfaces
I referenced a project with a nuget package. The referenced project contains one interface with at least one method that returns types from the nuget package. I excluded this interface and the interface is successfully ignored by SimpleStubs. However, the using directive to the nuget package is still there and I cannot build the UnitTest project. I have to reference the nuget package to make it build.
Does the file containing the excluded interface contain any other interfaces? SimpleStubs will copy the using directives from a given file if there is at least one interface in that file that is not ignored.
No that's not the case. The ignored interface is the only one with a using of a type of that nuget package.
Ok thanks. I suspect that this is copying the usings from the whole namespace, not just from the files containing non-ignored interfaces.
If the ignored interface was in a different namespace, I believe the using would not be copied. We should probably just copy the usings from the files containing used interfaces instead of resolving all usings in the namespace.