Example #1
0
        public void SwitchScene_SceneScopeIsCreated()
        {
            var logger            = new LoggerMockup();
            var sceneScopeFactory = new SceneScopeFactoryMockup();

            var moduleResources     = new SingularityModules[0];
            var sceneEventsProvider = new SceneEventsProviderMockup();

            using (var scope = new GameScope(logger, sceneScopeFactory, sceneEventsProvider, moduleResources))
            {
                sceneEventsProvider.TriggerEntered();

                Assert.Single(sceneScopeFactory.CreateCalls);
            }
        }
Example #2
0
        public void SceneIsDisposed_SceneScopeIsDiposed()
        {
            var logger            = new LoggerMockup();
            var sceneScopeFactory = new SceneScopeFactoryMockup();

            var moduleResources     = new SingularityModules[0];
            var sceneEventsProvider = new SceneEventsProviderMockup();

            using (var scope = new GameScope(logger, sceneScopeFactory, sceneEventsProvider, moduleResources))
            {
                sceneEventsProvider.TriggerEntered();

                SceneScope createdSceneScope = sceneScopeFactory.CreatedSceneScopes[0];
                Assert.False(createdSceneScope.IsDisposed);

                sceneEventsProvider.TriggerLeaving();
                Assert.True(createdSceneScope.IsDisposed);
            }
        }