Esempio n. 1
0
        public void UpdateStatus()
        {
            // Arrange
            var obj = new SampleStateful(true);

            // Act
            obj.Submit();

            // Assert
            Assert.Equal(SampleStates.Submitted, obj.Status.CurrentState);
        }
Esempio n. 2
0
        public void ExecuteOnEntryAndOnExitActions()
        {
            // Arrange
            var obj = new SampleStateful(true);

            // Act
            obj.Submit();

            // Assert
            Assert.True(obj.EntryActionCalled);
            Assert.True(obj.ExitActionCalled);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }