Initial Commit

This commit is contained in:
2026-03-16 14:38:46 +02:00
commit b8f7327a21
2327 changed files with 253610 additions and 0 deletions
@@ -0,0 +1,74 @@
using NUnit.Framework;
using Assert = ModestTree.Assert;
namespace Zenject.Tests
{
[TestFixture]
public class TestValidationSettings
{
DiContainer Container
{
get; set;
}
[SetUp]
public void Setup()
{
Container = new DiContainer(true);
}
// Doesn't work because the logged error is flagged as a test error
//[Test]
//public void TestValidationErrorLogOnly()
//{
//Container.Settings = new ZenjectSettings(ValidationErrorResponses.Log);
//Container.Bind<Bar>().AsSingle().NonLazy();
//Container.ResolveRoots();
//}
[Test]
public void TestValidationErrorThrows()
{
Container.Settings = new ZenjectSettings(ValidationErrorResponses.Throw);
Container.Bind<Bar>().AsSingle().NonLazy();
Assert.Throws(() => Container.ResolveRoots());
}
[Test]
public void TestOutsideObjectGraph1()
{
Container.Settings = new ZenjectSettings(ValidationErrorResponses.Throw);
Container.Bind<Bar>().AsSingle();
Container.ResolveRoots();
}
[Test]
public void TestOutsideObjectGraph2()
{
Container.Settings = new ZenjectSettings(
ValidationErrorResponses.Throw, RootResolveMethods.All);
Container.Bind<Bar>().AsSingle();
Assert.Throws(() => Container.ResolveRoots());
}
public class Bar
{
public Bar(Foo foo)
{
}
}
public class Foo
{
}
}
}