From a23ac17933cfbc15035e865a510a71006ea8d82f Mon Sep 17 00:00:00 2001 From: Steve Vermeulen Date: Sun, 7 Feb 2016 14:39:23 -0400 Subject: [PATCH] Added integration tests --- .../IntegrationTests/IntegrationTests.unity | 621 ++++++++++++++++++ .../IntegrationTests.unity.meta | 8 + .../IntegrationTests/Tests.meta | 9 + .../IntegrationTests/Tests/Common.meta | 9 + .../IntegrationTests/Tests/Common/BarMono1.cs | 12 + .../Tests/Common/BarMono1.cs.meta | 12 + .../IntegrationTests/Tests/Common/FooMono1.cs | 12 + .../Tests/Common/FooMono1.cs.meta | 12 + .../Tests/Common/MonoInstallerTestFixture.cs | 99 +++ .../Common/MonoInstallerTestFixture.cs.meta | 12 + .../Tests/Common/Resources.meta | 9 + .../Tests/Common/Resources/BarMono1.prefab | 52 ++ .../Common/Resources/BarMono1.prefab.meta | 8 + .../Common/Resources/FooMonAndBarMono.prefab | 64 ++ .../Resources/FooMonAndBarMono.prefab.meta | 8 + .../Tests/Common/Resources/FooMono1.prefab | 52 ++ .../Common/Resources/FooMono1.prefab.meta | 8 + .../Common/Resources/FooMono1Other.prefab | 52 ++ .../Resources/FooMono1Other.prefab.meta | 8 + .../Tests/TestConflictingToSingleUses.cs | 106 +++ .../Tests/TestConflictingToSingleUses.cs.meta | 12 + .../Tests/TestToSingleGameObject.cs | 41 ++ .../Tests/TestToSingleGameObject.cs.meta | 12 + .../Tests/TestToSingleMonoBehaviour.cs | 61 ++ .../Tests/TestToSingleMonoBehaviour.cs.meta | 12 + .../Tests/TestToSinglePrefab.cs | 73 ++ .../Tests/TestToSinglePrefab.cs.meta | 12 + .../Tests/TestToSinglePrefabResource.cs | 64 ++ .../Tests/TestToSinglePrefabResource.cs.meta | 12 + .../Tests/TestToTransientGameObject.cs | 41 ++ .../Tests/TestToTransientGameObject.cs.meta | 12 + .../Tests/TestToTransientPrefab.cs | 32 + .../Tests/TestToTransientPrefab.cs.meta | 12 + .../Tests/TestToTransientPrefabResource.cs | 31 + .../TestToTransientPrefabResource.cs.meta | 12 + 35 files changed, 1612 insertions(+) create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs.meta create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs create mode 100644 UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs.meta diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity new file mode 100644 index 000000000..a0a9cedbf --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity @@ -0,0 +1,621 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &243487865 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 243487867} + - 114: {fileID: 243487866} + m_Layer: 0 + m_Name: TestRunner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &243487866 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 243487865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c3afc1c624179749bcdecf7b0224902, type: 3} + m_Name: + m_EditorClassIdentifier: + currentTest: {fileID: 0} +--- !u!4 &243487867 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 243487865} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &440259322 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 440259325} + - 114: {fileID: 440259324} + - 114: {fileID: 440259323} + m_Layer: 0 + m_Name: ToTransientPrefabResource + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &440259323 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 440259322} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0814876170b710b478ba31492a48c78f, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &440259324 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 440259322} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &440259325 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 440259322} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 7 +--- !u!1 &923059358 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 923059361} + - 114: {fileID: 923059360} + - 114: {fileID: 923059359} + m_Layer: 0 + m_Name: ToSingleMonoBehaviour + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &923059359 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 923059358} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7423e10ed873fc54f846476b25896321, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &923059360 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 923059358} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &923059361 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 923059358} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 8 +--- !u!1 &1021729099 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1021729102} + - 114: {fileID: 1021729101} + - 114: {fileID: 1021729100} + m_Layer: 0 + m_Name: ToTransientPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1021729100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1021729099} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9a11ff4a9421f2949993c4dc34f50335, type: 3} + m_Name: + m_EditorClassIdentifier: + FooMono1Prefab: {fileID: 154292, guid: 7d3811faab260ce4dab063fd012b42b5, type: 2} +--- !u!114 &1021729101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1021729099} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1021729102 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1021729099} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 +--- !u!1 &1200984789 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1200984792} + - 114: {fileID: 1200984791} + - 114: {fileID: 1200984790} + m_Layer: 0 + m_Name: TestToSingleGameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1200984790 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1200984789} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2deb5ef0bad19eb4985c9211357fd32f, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1200984791 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1200984789} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1200984792 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1200984789} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1273757714 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1273757718} + - 114: {fileID: 1273757717} + - 114: {fileID: 1273757715} + m_Layer: 0 + m_Name: TestToSinglePrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1273757715 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1273757714} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4bdba255fd33e7b4988c063646ce127f, type: 3} + m_Name: + m_EditorClassIdentifier: + FooMono1Prefab: {fileID: 154292, guid: 7d3811faab260ce4dab063fd012b42b5, type: 2} + FooMono1AndBarMono1Prefab: {fileID: 154292, guid: 8050b19557101e64b8ceedd823a8c394, + type: 2} +--- !u!114 &1273757717 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1273757714} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1273757718 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1273757714} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 +--- !u!1 &1512625147 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1512625151} + - 114: {fileID: 1512625150} + - 114: {fileID: 1512625148} + m_Layer: 0 + m_Name: TestToSinglePrefabResource + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1512625148 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1512625147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ca081038c093143489baf1803e226a21, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1512625150 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1512625147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1512625151 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1512625147} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 +--- !u!1 &1920766032 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1920766036} + - 114: {fileID: 1920766035} + - 114: {fileID: 1920766033} + m_Layer: 0 + m_Name: TestToSingleConflicts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1920766033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1920766032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7236811c40b6085418728c8afd1e07ca, type: 3} + m_Name: + m_EditorClassIdentifier: + FooMono1Prefab: {fileID: 154292, guid: 7d3811faab260ce4dab063fd012b42b5, type: 2} + FooMono1OtherPrefab: {fileID: 154292, guid: 47195f24f3baa5444914be8a11f7429c, type: 2} +--- !u!114 &1920766035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1920766032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1920766036 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1920766032} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &2061069482 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2061069485} + - 114: {fileID: 2061069484} + - 114: {fileID: 2061069483} + m_Layer: 0 + m_Name: ToTransientGameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &2061069483 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2061069482} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f501effa670d9634cb38b13d609afa58, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &2061069484 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2061069482} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &2061069485 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2061069482} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity.meta new file mode 100644 index 000000000..00ff0be2f --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/IntegrationTests.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c9861a2b299f08f4fb8940460f1c306c +timeCreated: 1454598001 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests.meta new file mode 100644 index 000000000..4d4f4a3ac --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5c8e0cea495eb6d4abcf9db64ae994af +folderAsset: yes +timeCreated: 1454691682 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common.meta new file mode 100644 index 000000000..d54fe739e --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2ae0f45fc0f363e4b8369aeb4ffd73d5 +folderAsset: yes +timeCreated: 1454724184 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs new file mode 100644 index 000000000..8dac6eaec --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class BarMono1 : MonoBehaviour, IInitializable + { + public void Initialize() + { + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs.meta new file mode 100644 index 000000000..45b12ff9d --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/BarMono1.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d63c2c7069c31924fb08fda7448f18fd +timeCreated: 1454692919 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs new file mode 100644 index 000000000..1b716c876 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class FooMono1 : MonoBehaviour, IInitializable + { + public void Initialize() + { + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs.meta new file mode 100644 index 000000000..152081ec2 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/FooMono1.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 99aa66a71b67fe840bd6cd4a04bf061d +timeCreated: 1454692674 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs new file mode 100644 index 000000000..3045a0758 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + public class InstallerTestAttribute : Attribute + { + } + + public abstract class MonoInstallerTestFixture : MonoBehaviour + { + protected DiContainer Container + { + get; + private set; + } + + public void Start() + { + StartCoroutine(Run()); + } + + IEnumerator Run() + { + GlobalCompositionRoot.Instance.EnsureIsInitialized(); + + var testMethods = this.GetType().GetAllMethods( + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) + .Where(x => x.GetCustomAttributes(typeof(InstallerTestAttribute), false).Any()).ToList(); + + foreach (var method in testMethods) + { + var wrapper = new InstallerWrapper(); + wrapper.InstallCallback = () => + { + Container = wrapper.GetContainer(); + method.Invoke(this, new object[0]); + }; + + var settings = new SceneCompositionRoot.StaticSettings() + { + Installers = new List() { wrapper }, + ParentNewObjectsUnderRoot = true, + OnlyInjectWhenActive = true, + }; + + var oldRootObjects = this.gameObject.scene.GetRootGameObjects(); + + var root = SceneCompositionRoot.Instantiate(gameObject, settings); + + // Wait a few frames to have it start up + yield return null; + yield return null; + yield return null; + yield return null; + + GameObject.Destroy(root.gameObject); + + foreach (Transform childTransform in this.gameObject.transform) + { + GameObject.Destroy(childTransform.gameObject); + } + + foreach (var obj in this.gameObject.scene.GetRootGameObjects().Except(oldRootObjects)) + { + GameObject.Destroy(obj); + } + + yield return null; + + Log.Trace("Installer Test '{0}' passed successfully", method.Name); + } + + Log.Trace("All Installer Tests passed successfully"); + IntegrationTest.Pass(); + } + + class InstallerWrapper : Installer + { + public Action InstallCallback; + + public DiContainer GetContainer() + { + return Container; + } + + public override void InstallBindings() + { + InstallCallback(); + } + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs.meta new file mode 100644 index 000000000..a30ffec49 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/MonoInstallerTestFixture.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0f0a7da5d3ed1e744a3a5809a1797ac8 +timeCreated: 1454725431 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources.meta new file mode 100644 index 000000000..11b1b9c9c --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3a5c07200c502ab4c8352f394a5b4b2c +folderAsset: yes +timeCreated: 1454724169 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab new file mode 100644 index 000000000..dbd341273 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &154292 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 496146} + - 114: {fileID: 11464982} + m_Layer: 0 + m_Name: BarMono1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &496146 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11464982 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d63c2c7069c31924fb08fda7448f18fd, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 154292} + m_IsPrefabParent: 1 diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab.meta new file mode 100644 index 000000000..06468420b --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/BarMono1.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4795ced861987e84f90dcf5335743d12 +timeCreated: 1454693031 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab new file mode 100644 index 000000000..2fb2bed39 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab @@ -0,0 +1,64 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &154292 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 496146} + - 114: {fileID: 11488132} + - 114: {fileID: 11408906} + m_Layer: 0 + m_Name: FooMonAndBarMono + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &496146 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11408906 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d63c2c7069c31924fb08fda7448f18fd, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &11488132 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99aa66a71b67fe840bd6cd4a04bf061d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 154292} + m_IsPrefabParent: 1 diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab.meta new file mode 100644 index 000000000..e6d0b3ae7 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMonAndBarMono.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8050b19557101e64b8ceedd823a8c394 +timeCreated: 1454809697 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab new file mode 100644 index 000000000..adb825458 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &154292 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 496146} + - 114: {fileID: 11488132} + m_Layer: 0 + m_Name: FooMono1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &496146 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11488132 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99aa66a71b67fe840bd6cd4a04bf061d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 154292} + m_IsPrefabParent: 1 diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab.meta new file mode 100644 index 000000000..a10590a8d --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d3811faab260ce4dab063fd012b42b5 +timeCreated: 1454692704 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab new file mode 100644 index 000000000..1a03b3624 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &154292 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 496146} + - 114: {fileID: 11488132} + m_Layer: 0 + m_Name: FooMono1Other + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &496146 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11488132 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 154292} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99aa66a71b67fe840bd6cd4a04bf061d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 154292} + m_IsPrefabParent: 1 diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab.meta new file mode 100644 index 000000000..8ff0ba710 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/Common/Resources/FooMono1Other.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47195f24f3baa5444914be8a11f7429c +timeCreated: 1454808880 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs new file mode 100644 index 000000000..509d63b8d --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs @@ -0,0 +1,106 @@ +using System; +using System.Linq; +using System.Reflection; +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestConflictingToSingleUses : MonoInstallerTestFixture + { + public GameObject FooMono1Prefab; + public GameObject FooMono1OtherPrefab; + + [InstallerTest] + public void TestToSinglePrefab() + { + Container.Bind().ToSinglePrefab(FooMono1Prefab); + + Assert.Throws(() => Container.Bind().ToSingleGameObject()); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1OtherPrefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1")); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1Other")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1OtherPrefab)); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(new GameObject())); + } + + [InstallerTest] + public void TestToSingleGameObject() + { + Container.Bind().ToSingleGameObject(); + + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1")); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1Other")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(new GameObject())); + } + + [InstallerTest] + public void TestToSinglePrefabResource() + { + Container.Bind().ToSinglePrefabResource("FooMono1"); + + Assert.Throws(() => Container.Bind().ToSingleGameObject()); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1Other")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(new GameObject())); + } + + [InstallerTest] + public void TestToSingleMethod() + { + Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent()); + + Assert.Throws(() => Container.Bind().ToSingleGameObject()); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(new GameObject())); + } + + [InstallerTest] + public void TestToSingleInstance() + { + Container.Bind().ToSingleInstance(new GameObject().AddComponent()); + + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleGameObject()); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(new GameObject())); + } + + [InstallerTest] + public void TestToSingleMonoBehaviour() + { + Container.Bind().ToSingleMonoBehaviour(new GameObject()); + + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleGameObject()); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + Assert.Throws(() => Container.Bind().ToSinglePrefabResource("FooMono1")); + Assert.Throws(() => Container.Bind().ToSingleMethod((ctx) => new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToSingleInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToInstance(new GameObject().AddComponent())); + Assert.Throws(() => Container.Bind().ToTransientPrefab(FooMono1Prefab)); + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs.meta new file mode 100644 index 000000000..c1ca497b2 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestConflictingToSingleUses.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7236811c40b6085418728c8afd1e07ca +timeCreated: 1454692919 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs new file mode 100644 index 000000000..6b4344f75 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestToSingleGameObject : MonoInstallerTestFixture + { + [InstallerTest] + public void TestBindingsOnSameGameObject() + { + Container.Bind().ToSingleGameObject(); + Container.Bind().ToSingleGameObject(); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner : IInitializable + { + readonly Foo _foo; + + public Runner(Foo foo) + { + _foo = foo; + } + + public void Initialize() + { + Assert.IsNotNull(_foo); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1, + "Found multiple instances of type Foo in scene"); + } + } + + public class Foo : MonoBehaviour, IInitializable + { + public void Initialize() + { + } + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs.meta new file mode 100644 index 000000000..cdcbe8ac0 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleGameObject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2deb5ef0bad19eb4985c9211357fd32f +timeCreated: 1454598516 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs new file mode 100644 index 000000000..c79b88cce --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using Zenject; +using UnityEngine; + +namespace ModestTree +{ + public class TestToSingleMonoBehaviour : MonoInstallerTestFixture + { + GameObject _gameObject; + + [InstallerTest] + public void Test1() + { + _gameObject = new GameObject(); + _gameObject.transform.SetParent(this.transform, false); + + Container.BindInstance(this); + Container.Bind().ToSingleMonoBehaviour(_gameObject); + Container.Bind().ToSingle(); + } + + public class Runner1 : IInitializable + { + public Runner1(FooMono1 foo, TestToSingleMonoBehaviour owner) + { + Assert.IsEqual(owner._gameObject, foo.gameObject); + } + + public void Initialize() + { + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + } + } + + [InstallerTest] + public void TestMultipleBindings() + { + _gameObject = new GameObject(); + _gameObject.transform.SetParent(this.transform, false); + + Container.BindInstance(this); + Container.Bind().ToSingleMonoBehaviour(_gameObject); + Container.Bind().ToSingleMonoBehaviour(_gameObject); + Container.Bind().ToSingle(); + } + + [InstallerTest] + public void TestDuplicatesError() + { + _gameObject = new GameObject(); + _gameObject.transform.SetParent(this.transform, false); + + var gameObject2 = new GameObject(); + gameObject2.transform.SetParent(this.transform, false); + + Container.BindInstance(this); + Container.Bind().ToSingleMonoBehaviour(_gameObject); + Assert.Throws(() => Container.Bind().ToSingleMonoBehaviour(gameObject2)); + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs.meta new file mode 100644 index 000000000..4d00035db --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSingleMonoBehaviour.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7423e10ed873fc54f846476b25896321 +timeCreated: 1454850316 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs new file mode 100644 index 000000000..1eafb4555 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs @@ -0,0 +1,73 @@ +using System.Linq; +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestToSinglePrefab : MonoInstallerTestFixture + { + public GameObject FooMono1Prefab; + public GameObject FooMono1AndBarMono1Prefab; + + [InstallerTest] + public void TestSamePrefabMultipleTypes() + { + Container.Bind().ToSinglePrefab(FooMono1Prefab); + Container.Bind().ToSinglePrefab(FooMono1Prefab); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner1 : IInitializable + { + readonly FooMono1 _foo; + + public Runner1(FooMono1 foo) + { + _foo = foo; + } + + public void Initialize() + { + Assert.IsNotNull(_foo); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + } + } + + [InstallerTest] + public void TestToSinglePrefabSamePrefabMultipleTypes() + { + Container.Bind().ToSinglePrefab(FooMono1AndBarMono1Prefab); + Container.Bind().ToSinglePrefab(FooMono1AndBarMono1Prefab); + + Container.Bind().ToSinglePrefab(FooMono1AndBarMono1Prefab); + Container.Bind().ToSinglePrefab(FooMono1AndBarMono1Prefab); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner2 : IInitializable + { + public Runner2(FooMono1 foo, BarMono1 bar) + { + } + + public void Initialize() + { + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + + Assert.IsEqual( + GameObject.FindObjectsOfType().Single().gameObject, + GameObject.FindObjectsOfType().Single().gameObject); + } + } + + [InstallerTest] + public void TestToSinglePrefabSameTypeDifferentPrefab() + { + Container.Bind().ToSinglePrefab(FooMono1AndBarMono1Prefab); + Assert.Throws(() => Container.Bind().ToSinglePrefab(FooMono1Prefab)); + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs.meta new file mode 100644 index 000000000..936cc7fea --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefab.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4bdba255fd33e7b4988c063646ce127f +timeCreated: 1454798597 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs new file mode 100644 index 000000000..6d0fa34f4 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs @@ -0,0 +1,64 @@ +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestToSinglePrefabResource : MonoInstallerTestFixture + { + [InstallerTest] + public void TestMultipleBindingsOnSamePrefab() + { + Container.Bind().ToSinglePrefabResource("FooMono1"); + Container.Bind().ToSinglePrefabResource("FooMono1"); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner1 : IInitializable + { + readonly FooMono1 _foo; + + public Runner1(FooMono1 foo) + { + _foo = foo; + } + + public void Initialize() + { + Assert.IsNotNull(_foo); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + } + } + + [InstallerTest] + public void Test2() + { + Container.Bind().ToSinglePrefabResource("FooMono1"); + Container.Bind().ToSinglePrefabResource("BarMono1"); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner2 : IInitializable + { + readonly BarMono1 _bar; + readonly FooMono1 _foo; + + public Runner2( + FooMono1 foo, + BarMono1 bar) + { + _bar = bar; + _foo = foo; + } + + public void Initialize() + { + Assert.IsNotNull(_bar); + Assert.IsNotNull(_foo); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + } + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs.meta new file mode 100644 index 000000000..3e88a8602 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToSinglePrefabResource.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ca081038c093143489baf1803e226a21 +timeCreated: 1454720329 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs new file mode 100644 index 000000000..d6efd95fd --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestToTransientGameObject : MonoInstallerTestFixture + { + [InstallerTest] + public void Test1() + { + Container.Bind().ToTransientGameObject(); + Container.Bind().ToTransientGameObject(); + Container.Bind().ToTransientGameObject(); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner : IInitializable + { + public Runner( + List foo, Bar bar) + { + } + + public void Initialize() + { + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 2); + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 1); + } + } + + public class Bar : MonoBehaviour + { + } + + public class Foo : MonoBehaviour + { + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs.meta new file mode 100644 index 000000000..a72f8cc41 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientGameObject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f501effa670d9634cb38b13d609afa58 +timeCreated: 1454819951 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs new file mode 100644 index 000000000..b77681f92 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using UnityEngine; +using Zenject; + +namespace ModestTree +{ + public class TestToTransientPrefab : MonoInstallerTestFixture + { + public GameObject FooMono1Prefab; + + [InstallerTest] + public void TestSamePrefabMultipleTypes() + { + Container.Bind().ToTransientPrefab(FooMono1Prefab); + Container.Bind().ToTransientPrefab(FooMono1Prefab); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner1 : IInitializable + { + public Runner1(List foos) + { + } + + public void Initialize() + { + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 2); + } + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs.meta new file mode 100644 index 000000000..9a9366c94 --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefab.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a11ff4a9421f2949993c4dc34f50335 +timeCreated: 1454819941 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs new file mode 100644 index 000000000..f23a211df --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Zenject; +using UnityEngine; + +namespace ModestTree +{ + public class TestToTransientPrefabResource : MonoInstallerTestFixture + { + [InstallerTest] + public void Test1() + { + Container.Bind().ToTransientPrefabResource("FooMono1"); + Container.Bind().ToTransientPrefabResource("FooMono1"); + Container.Bind().ToTransientPrefabResource("FooMono1"); + + Container.BindAllInterfacesToSingle(); + } + + public class Runner1 : IInitializable + { + public Runner1(List foo) + { + } + + public void Initialize() + { + Assert.IsEqual(GameObject.FindObjectsOfType().Length, 3); + } + } + } +} diff --git a/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs.meta b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs.meta new file mode 100644 index 000000000..43844ae8a --- /dev/null +++ b/UnityProject/Assets/Zenject/OptionalExtras/IntegrationTests/Tests/TestToTransientPrefabResource.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0814876170b710b478ba31492a48c78f +timeCreated: 1454820265 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: