I want to apply the same assembly convention to all projects in my solution.
Currently the TheAssembly static helper method only supports returning a single Assembly, and in fact throws an exception if you put a wildcard it because it recognises multiple matches.
My current solution was to write code like this:
public void ProjectsMustNotReferenceDllsFromBinOrObjDirectories()
{
var candidates = Directory.GetFiles(KnownPaths.SolutionRoot, "*.csproj", SearchOption.AllDirectories)
.Select(path => new AssemblySpecimen(path));
if (candidates.Any() == false)
{
throw new ConventionException("Could not locate a project file matching the pattern *.csproj");
}
foreach (var asm in candidates)
{
asm.MustConformTo(Convention.MustNotReferenceDllsFromBinOrObjDirectories).WithFailureAssertion(Assert.Fail);
}
}
In general it would be great to apply conventions to collections of things.
I want to apply the same assembly convention to all projects in my solution.
Currently the
TheAssembly
static helper method only supports returning a single Assembly, and in fact throws an exception if you put a wildcard it because it recognises multiple matches.My current solution was to write code like this:
In general it would be great to apply conventions to collections of things.