示例#1
0
        public void TestProgressReporting()
        {
            using (
                TestLoadingScreenState loadingScreen =
                    new TestLoadingScreenState(this.stateManager, this.testState)
                ) {
                loadingScreen.Initialize();

                // Before StartLoading(), progress reports are ignored
                this.testState.SetProgress(0.123f);
                Assert.AreNotEqual(0.123f, loadingScreen.LoadProgress);

                // Begin the asynchronous loading process
                this.testState.Asynchronous = true;
                loadingScreen.StartLoading();

                // This progress report should be accepted
                this.testState.SetProgress(0.1234f);
                Assert.AreEqual(0.1234f, loadingScreen.LoadProgress);

                // Move the game state into the completed state
                TestGameState.AsynchronousAsyncResult asyncResult =
                    (this.testState.AsyncResult as TestGameState.AsynchronousAsyncResult);
                asyncResult.SetCompleted();

                // This progress report should not be processed anymore
                this.testState.SetProgress(0.12345f);
                Assert.AreNotEqual(0.12345f, loadingScreen.LoadProgress);
            }
        }
示例#2
0
 public void TestGameStateToLoad()
 {
     using (
         TestLoadingScreenState loadingScreen =
             new TestLoadingScreenState(this.stateManager, this.testState)
         ) {
         Assert.AreSame(this.testState, loadingScreen.GameStateToLoad);
     }
 }