mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 16:17:59 +00:00
Added a NUnit test project for the whole solution
This commit is contained in:
6 files changed
+135
-1
No files matched your search
@@ -0,0 +1,26 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
//
|
||||
// Deliberately without a namespace: NUnit then applies this fixture to the whole assembly, so every
|
||||
// test -- the ones written today and the ones written later in some other folder -- starts with the
|
||||
// static state below already in place. A second setup fixture would only ever be needed for state
|
||||
// that must not leak between areas.
|
||||
//
|
||||
namespace AIStudio.Tests;
|
||||
|
||||
[SetUpFixture]
|
||||
public sealed class TestHost
|
||||
{
|
||||
[OneTimeSetUp]
|
||||
public void PrepareStaticApplicationState()
|
||||
{
|
||||
//
|
||||
// A number of types in the app hold a static logger field that is initialized from
|
||||
// Program.LOGGER_FACTORY, among them Settings.Provider. The app assigns that factory while
|
||||
// Kestrel comes up; in a test process nobody does, so it stays null and the first touch of
|
||||
// such a type dies inside its type initializer -- before a single assertion runs. A factory
|
||||
// that writes nowhere is all it takes to get past that.
|
||||
//
|
||||
Program.LOGGER_FACTORY = NullLoggerFactory.Instance;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user