コード例 #1
0
        public void UpdateStatus()
        {
            // Arrange
            var obj = new SampleStateful(true);

            // Act
            obj.Submit();

            // Assert
            Assert.Equal(SampleStates.Submitted, obj.Status.CurrentState);
        }
コード例 #2
0
        public void ExecuteOnEntryAndOnExitActions()
        {
            // Arrange
            var obj = new SampleStateful(true);

            // Act
            obj.Submit();

            // Assert
            Assert.True(obj.EntryActionCalled);
            Assert.True(obj.ExitActionCalled);
        }
コード例 #3
0
        public void NotInvokeActionIfNoTransitionIsAvailable()
        {
            // Arrange
            var obj = new SampleStateful(false);

            obj.ShouldAllowTransition = false;
            var expectedSubmitCallCount = obj.SubmitCallCount;

            // Act
            obj.Submit();

            // Assert
            Assert.Equal(expectedSubmitCallCount, obj.SubmitCallCount);
        }
コード例 #4
0
        public void ConsiderTriggerGuardIfObjectIsCorrectType()
        {
            // Arrange
            var obj = new SampleStateful(false);

            obj.ShouldAllowTransition = false;
            var expectedCount = obj.Status.TransitionHistory.Count;

            // Act
            obj.Submit();

            // Assert
            Assert.Equal(expectedCount, obj.Status.TransitionHistory.Count);
            Assert.Equal(SampleStates.Draft, obj.Status.CurrentState);
        }