I have written my first test where I want to assert that a namespace only depends on itself. I think that should be an easy test to write, the use case should be very common, but the library doesn't support that.
The TestResult only contains failed types, and not the invalid types they depend on.
The test still fails after I have fixed the obvious mistakes. There are no more invalid using statements in my source, which make me suspect I use some of the global dependencies found in the generated GlobalUsings.g.cs:
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
global using global::Xunit;
I included all of them in my test, but it still fails:
var types = Types.InCurrentDomain();
var result = types.That().ResideInNamespace("EventSourcingExplorations.EventSourcing")
.Should().OnlyHaveDependenciesOn(
"EventSourcingExplorations.EventSourcing",
"EventSourcingExplorations.EventSourcing.Exceptions",
// GlobalUsings.g.cs below
"System",
"System.Collections.Generic",
"System.IO",
"System.Linq",
"System.Net.Http",
"System.Threading",
"System.Threading.Tasks",
"Xunit",
"EventSourcingExplorations.EventSourcing.Exceptions"
)
.GetResult();
result.FailingTypeNames.Should().BeEmpty();
This project is a wonderful initiative, and something really needed. But I cannot use this if I have to dig into generated files and understand the internals.
Please, add a member to TestResult which expose each broken type with their invalid dependencies. While not perfect, it would be so much easier to identify coding mistakes or to fine tune the tests.
I have written my first test where I want to assert that a namespace only depends on itself. I think that should be an easy test to write, the use case should be very common, but the library doesn't support that.
The
TestResultonly contains failed types, and not the invalid types they depend on.The test still fails after I have fixed the obvious mistakes. There are no more invalid using statements in my source, which make me suspect I use some of the global dependencies found in the generated
GlobalUsings.g.cs:I included all of them in my test, but it still fails:
This project is a wonderful initiative, and something really needed. But I cannot use this if I have to dig into generated files and understand the internals.
Please, add a member to
TestResultwhich expose each broken type with their invalid dependencies. While not perfect, it would be so much easier to identify coding mistakes or to fine tune the tests.