Initial Commit
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using ModestTree;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace Zenject.Tests
|
||||
{
|
||||
public class TestIntegrationTest : ZenjectIntegrationTestFixture
|
||||
{
|
||||
public class Foo : IInitializable, IDisposable
|
||||
{
|
||||
public static bool WasDisposed
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public static bool WasInitialized
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
WasInitialized = true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
WasDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestRun()
|
||||
{
|
||||
PreInstall();
|
||||
|
||||
Foo.WasDisposed = false;
|
||||
Foo.WasInitialized = false;
|
||||
|
||||
Container.BindInterfacesTo<Foo>().AsSingle();
|
||||
|
||||
Assert.That(!Foo.WasInitialized);
|
||||
|
||||
PostInstall();
|
||||
|
||||
yield return null;
|
||||
|
||||
Assert.That(Foo.WasInitialized);
|
||||
|
||||
yield return DestroyEverything();
|
||||
|
||||
Assert.That(Foo.WasDisposed);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestSkipInstall()
|
||||
{
|
||||
SkipInstall();
|
||||
yield break;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator TestProjectContextDestroyed()
|
||||
{
|
||||
Assert.That(!ProjectContext.HasInstance);
|
||||
SkipInstall();
|
||||
yield return null;
|
||||
Assert.That(ProjectContext.HasInstance);
|
||||
yield return DestroyEverything();
|
||||
Assert.That(!ProjectContext.HasInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 056c7f636d28cd740aa4f1506db0593d
|
||||
timeCreated: 1506428837
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user