コード例 #1
0
        public void FinishedNotification_OnlyLogsWarning_WhenNotFound()
        {
            var operationState = new FakeOperationState("Fake State");

            this.notificationsCallback(TestOperationStateTransition.Finished, operationState);

            LogAssert.Expect(LogType.Warning, new Regex("Could not find"));
            new VisualState(this.scrollView).AssertEmpty();
        }
コード例 #2
0
        public void CurrentOperations_AreCleared_WhenEnteringPlayMode()
        {
            var operationState = new FakeOperationState("Fake State");

            this.notificationsCallback(TestOperationStateTransition.Started, operationState);
            this.state.Update();
            this.playModeCallback(PlayModeStateChange.ExitingPlayMode);
            this.playModeCallback(PlayModeStateChange.EnteredPlayMode);

            new VisualState(this.scrollView).AssertEmpty();
        }
コード例 #3
0
        public void FinishedNotification_MovesStateLabelToPrevious()
        {
            var operationState = new FakeOperationState("Fake State");

            this.notificationsCallback(TestOperationStateTransition.Started, operationState);
            this.state.Update();
            this.notificationsCallback(TestOperationStateTransition.Finished, operationState);

            var visualState = new VisualState(this.scrollView);

            Assert.IsEmpty(visualState.CurrentOperations);
            Assert.AreEqual(operationState.StringRepresentation, visualState.PreviousOperation);
        }
コード例 #4
0
        public void LongStateText_GetsSplitIntoMultipleLabels_InPreviousOperation()
        {
            var fooAndNineteenEmptyLines = "foo" + new string('\n', 19);
            var operationState           = new FakeOperationState(fooAndNineteenEmptyLines + "\nbar");

            this.notificationsCallback(TestOperationStateTransition.Started, operationState);
            this.notificationsCallback(TestOperationStateTransition.Finished, operationState);
            this.state.Update();

            var visualState = new VisualState(this.scrollView);

            CollectionAssert.AreEqual(
                new[] { fooAndNineteenEmptyLines, "bar" },
                visualState.PreviousOperation);
        }
コード例 #5
0
        public void StartedNotification_AddsStateLabel()
        {
            var operationState1 = new FakeOperationState("Fake State 1");

            this.notificationsCallback(TestOperationStateTransition.Started, operationState1);
            var operationState2 = new FakeOperationState("Fake State 2");

            this.notificationsCallback(TestOperationStateTransition.Started, operationState2);
            this.state.Update();

            var visualState = new VisualState(this.scrollView);

            CollectionAssert.AreEqual(
                new[] { operationState1.StringRepresentation, operationState2.StringRepresentation },
                visualState.CurrentOperations);
            Assert.IsEmpty(visualState.PreviousOperation);
        }
コード例 #6
0
        public void MultipleOperations_OperateCorrectly()
        {
            var state1 = new FakeOperationState("Fake State 1");
            var state2 = new FakeOperationState("Fake State 2");

            this.notificationsCallback(TestOperationStateTransition.Started, state1);
            this.state.Update();
            this.notificationsCallback(TestOperationStateTransition.Started, state2);
            this.state.Update();
            this.notificationsCallback(TestOperationStateTransition.Finished, state1);
            this.state.Update();

            var visualState = new VisualState(this.scrollView);

            CollectionAssert.AreEqual(
                new[] { state2.StringRepresentation },
                visualState.CurrentOperations);
            Assert.AreEqual(state1.StringRepresentation, visualState.PreviousOperation);
        }