Exemplo n.º 1
0
        public void TestPrefabConcreteSingle1()
        {
            Container.BindFactory <UnityEngine.Object, ObjectFactory>().To <GameObject>().FromPrefab(CubePrefab).WithGameObjectName(GameObjName);

            FixtureUtil.CallFactoryCreateMethod <UnityEngine.Object, ObjectFactory>(Container);

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 2
0
        public void TestPrefabResourceConcreteSingle1()
        {
            Container.BindFactory <string, UnityEngine.Object, ObjectFactory>().To <GameObject>().FromPrefabResource("TestGameObjectFactoryOne/Cube").WithGameObjectName(GameObjName);

            AddFactoryUser <ObjectFactoryTester>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 3
0
        public void TestGameObjectSelfSingle1()
        {
            Container.Bind <GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle();

            Container.BindRootResolve <GameObject>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 4
0
        public void TestGameObjectConcreteSingle()
        {
            Container.Bind <UnityEngine.Object>().To <GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsSingle();

            Container.BindRootResolve <UnityEngine.Object>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 5
0
        public void TestPrefabSelfSingle1()
        {
            Container.BindFactory <GameObject, CubeFactory>().FromPrefab(CubePrefab).WithGameObjectName(GameObjName);

            FixtureUtil.CallFactoryCreateMethod <GameObject, CubeFactory>(Container);

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 6
0
        public void TestPrefabResourceSelfSingle1()
        {
            Container.BindFactory <string, GameObject, CubeFactory>().FromPrefabResource("TestGameObjectFactoryOne/Cube").WithGameObjectName(GameObjName);

            AddFactoryUser <CubeFactoryTester>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 7
0
        public void TestToPrefabResourceSelf()
        {
            Container.BindFactory <double, int, float, string, char, Foo, Foo.Factory>().FromPrefabResource("TestBindFactoryFive/Foo").WithGameObjectName("asdf");

            AddFactoryUser <Foo, Foo.Factory>();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 8
0
        public void TestToPrefabResourceConcrete()
        {
            Container.BindFactory <Foo, Foo.Factory>().To <Foo>().FromPrefabResource("TestBindFactory/Foo").WithGameObjectName("asdf");

            FixtureUtil.CallFactoryCreateMethod <Foo, Foo.Factory>(Container);

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 9
0
        public void TestGameObjectSelfTransient()
        {
            Container.Bind <GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsTransient();
            Container.Bind <GameObject>().FromGameObject().WithGameObjectName(GameObjName).AsTransient();
            Container.Bind <GameObject>().FromGameObject().WithGameObjectName("asdf").AsTransient();
            Container.BindRootResolve <GameObject>();

            FixtureUtil.AssertNumGameObjects(Container, 3);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 2);
        }
Exemplo n.º 10
0
        public void TestToPrefabResourceConcrete()
        {
            Container.BindFactory <string, IFoo, IFooFactory>().To <Foo>().FromPrefabResource("TestBindFactoryOne/Foo").WithGameObjectName("asdf");

            AddFactoryUser <IFoo, IFooFactory>();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 11
0
        public void TestToPrefabConcrete()
        {
            Container.BindFactory <IFoo, IFooFactory>().To <Foo>().FromPrefab(FooPrefab).WithGameObjectName("asdf");

            FixtureUtil.CallFactoryCreateMethod <IFoo, IFooFactory>(Container);

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 12
0
        public void TestToPrefabSelf()
        {
            Container.BindFactory <string, Foo, Foo.Factory>().FromPrefab(FooPrefab).WithGameObjectName("asdf");

            AddFactoryUser <Foo, Foo.Factory>();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 13
0
        public void TestToPrefabConcrete()
        {
            Container.BindFactory <double, int, float, string, char, IFoo, IFooFactory>().To <Foo>().FromPrefab(FooPrefab).WithGameObjectName("asdf");

            AddFactoryUser <IFoo, IFooFactory>();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 14
0
        public void TestPrefabConcreteSingle1()
        {
            Container.BindFactory <UnityEngine.Object, ObjectFactory>().To <GameObject>().FromPrefab(CubePrefab).WithGameObjectName(GameObjName);

            Initialize();

            Container.Resolve <ObjectFactory>().Create();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 15
0
        public void TestPrefabResourceSelfSingle1()
        {
            Container.Bind <GameObject>().FromPrefabResource("TestBindGameObject/Cube").WithGameObjectName(GameObjName).AsSingle().NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);

            Assert.IsNotNull(Container.Resolve <GameObject>().GetComponent <BoxCollider>());
        }
Exemplo n.º 16
0
        public void TestPrefabSelfSingle1()
        {
            Container.BindFactory <string, GameObject, CubeFactory>().FromPrefab(CubePrefab).WithGameObjectName(GameObjName);

            AddFactoryUser <CubeFactoryTester>();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 17
0
        public void TestCached1()
        {
            Container.Bind(typeof(Foo), typeof(Bar)).FromComponentInNewPrefab(FooPrefab).WithGameObjectName("Foo").AsCached().NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertComponentCount <Bar>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Foo", 1);
        }
Exemplo n.º 18
0
        public void TestPrefabSelfSingle1()
        {
            Container.BindFactory <GameObject, CubeFactory>().FromPrefab(CubePrefab).WithGameObjectName(GameObjName);

            Initialize();

            Container.Resolve <CubeFactory>().Create();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);
        }
Exemplo n.º 19
0
        public void TestPrefabResourceSelfSingle1()
        {
            Container.Bind <GameObject>().FromPrefabResource("BindGameObject/Cube").WithGameObjectName(GameObjName).AsSingle();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);

            FixtureUtil.AddInitMethod(Container, (GameObject gameObject) =>
            {
                Assert.IsNotNull(gameObject.GetComponent <BoxCollider>());
            });
        }
Exemplo n.º 20
0
        public void TestFromComponentInPrefab()
        {
            Container.BindFactory <Foo, Foo.Factory>().FromComponentInPrefab(FooPrefab).WithGameObjectName("asdf");

            Initialize();

            FixtureUtil.CallFactoryCreateMethod <Foo, Foo.Factory>(Container);

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 21
0
        public void TestSingleIdentifiers()
        {
            Container.Bind <Foo>().FromPrefabResource(PathPrefix + "Foo").WithGameObjectName("Foo").AsSingle().NonLazy();
            Container.Bind <Bar>().FromPrefabResource(PathPrefix + "Foo").WithGameObjectName("Foo").AsSingle().NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertComponentCount <Bar>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Foo", 1);
        }
Exemplo n.º 22
0
        public void TestPrefabConcreteSingle1()
        {
            Container.Bind <UnityEngine.Object>().To <GameObject>()
            .FromPrefab(CubePrefab).WithGameObjectName(GameObjName).AsSingle().NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);

            Assert.IsNotNull(((GameObject)Container.Resolve <UnityEngine.Object>()).GetComponent <BoxCollider>());
        }
Exemplo n.º 23
0
        public void TestToPrefabSelf()
        {
            Container.BindFactory <double, int, float, string, char, Foo, Foo.Factory>().FromComponentInNewPrefab(FooPrefab).WithGameObjectName("asdf");

            AddFactoryUser <Foo, Foo.Factory>();

            Initialize();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
        public void TestToPrefabResourceSelf()
        {
            Container.BindFactory <string, Foo, Foo.Factory>().FromComponentInNewPrefabResource("TestBindFactoryOne/Foo").WithGameObjectName("asdf");

            AddFactoryUser <Foo, Foo.Factory>();

            Initialize();

            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 25
0
        public void TestWithArguments()
        {
            Container.Bind(typeof(Gorp))
            .FromComponentInPrefabResource(PathPrefix + "Gorp").WithGameObjectName("Gorp").AsCached()
            .WithArguments("test1").NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Gorp>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Gorp", 1);
        }
Exemplo n.º 26
0
        public void TestCached1()
        {
            Container.Bind(typeof(Foo), typeof(Bar)).FromPrefabResource(PathPrefix + "Foo").WithGameObjectName("Foo").AsCached();

            Container.BindRootResolve <Foo>();
            Container.BindRootResolve <Bar>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertComponentCount <Bar>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Foo", 1);
        }
Exemplo n.º 27
0
        public void TestWithArgumentsSuccess()
        {
            Container.Bind <Gorp>().FromComponentInNewPrefab(GorpPrefab)
            .WithGameObjectName("Gorp").AsCached()
            .WithArguments("test1").NonLazy();

            Initialize();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Gorp>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Gorp", 1);
        }
Exemplo n.º 28
0
        public void TestFromComponentInPrefabComponent()
        {
            Container.BindFactory <Camera, CameraFactory>().FromComponentInNewPrefab(CameraPrefab).WithGameObjectName("asdf");

            Initialize();

            FixtureUtil.CallFactoryCreateMethod <Camera, CameraFactory>(Container);

            FixtureUtil.AssertComponentCount <Camera>(Container, 1);
            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "asdf", 1);
        }
Exemplo n.º 29
0
        public void TestSingleIdentifiers()
        {
            Container.Bind <Foo>().FromPrefab(FooPrefab).WithGameObjectName("Foo").AsSingle();
            Container.Bind <Bar>().FromPrefab(FooPrefab).WithGameObjectName("Foo").AsSingle();

            Container.BindRootResolve <Foo>();
            Container.BindRootResolve <Bar>();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertComponentCount <Foo>(Container, 1);
            FixtureUtil.AssertComponentCount <Bar>(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, "Foo", 1);
        }
Exemplo n.º 30
0
        public void TestPrefabConcreteSingle1()
        {
            Container.Bind <UnityEngine.Object>().To <GameObject>()
            .FromPrefab(CubePrefab).WithGameObjectName(GameObjName).AsSingle();

            FixtureUtil.AssertNumGameObjects(Container, 1);
            FixtureUtil.AssertNumGameObjectsWithName(Container, GameObjName, 1);

            FixtureUtil.AddInitMethod(Container, (UnityEngine.Object obj) =>
            {
                Assert.IsNotNull(((GameObject)obj).GetComponent <BoxCollider>());
            });
        }