public void Initialize()
        {
            Assert.That(!_hasStarted);
            _hasStarted = true;

            _sceneContext.Resolve();

            // This allows them to make very common bindings fields for use in any of the tests
            Container.Inject(this);

            if (_isValidating)
            {
                Container.ValidateIValidatables();
            }
            else
            {
                _sceneContext.gameObject.GetComponent <SceneKernel>().Start();
            }
        }
Exemplo n.º 2
0
        protected void PostInstall()
        {
            Assert.That(_hasStartedInstall,
                        "Called PostInstall but did not call PreInstall in test '{0}'!", TestContext.CurrentContext.Test.Name);

            Assert.That(!_hasEndedInstall, "Called PostInstall twice in test '{0}'!", TestContext.CurrentContext.Test.Name);

            _hasEndedInstall = true;
            _sceneContext.Resolve();

            Container.InjectGameobject(this);

            if (!Container.IsValidating)
            {
                // We don't have to do this here but it's kind of convenient
                // We could also remove it and just require that users add a yield after calling
                // and it would have the same effect
                Container.Resolve <MonoKernel>().Initialize();
            }
        }
Exemplo n.º 3
0
        protected void PostInstall()
        {
            Assert.That(_hasStartedInstall,
                        "Called PostInstall but did not call PreInstall in test '{0}'!", TestContext.CurrentContext.Test.Name);

            Assert.That(!_hasEndedInstall, "Called PostInstall twice in test '{0}'!", TestContext.CurrentContext.Test.Name);

            _hasEndedInstall = true;
            _sceneContext.Resolve();

            Container.Inject(this);

            if (Container.IsValidating)
            {
                Container.ValidateValidatables();
            }
            else
            {
                // This is necessary because otherwise MonoKernel is not started until later
                // and therefore IInitializable objects are not initialized
                Container.Resolve <MonoKernel>().Initialize();
            }
        }