Esempio n. 1
0
        public void TerminalStateIsNextStateIfTransitionFromTerminalStateOccurs()
        {
            //given
            var target = new BeaconSendingTerminalState();

            //then
            Assert.That(target.ShutdownState, Is.SameAs(target));
        }
Esempio n. 2
0
        public void StateIsTerminal()
        {
            // given
            var target = new BeaconSendingTerminalState();

            // then
            Assert.That(target.IsTerminalState, Is.True);
        }
        public void ToStringReturnsTheStateName()
        {
            // given
            var target = new BeaconSendingTerminalState();

            // when, then
            Assert.That(target.ToString(), Is.EqualTo("Terminal"));
        }
Esempio n. 4
0
        public void TerminalStateCallsShutdownOnExecution()
        {
            //given
            var target = new BeaconSendingTerminalState();

            // when
            target.Execute(context);

            // then
            context.Received(1).RequestShutdown();
        }
        public void ExecuteRequestsShutdown()
        {
            //given
            var target = new BeaconSendingTerminalState();

            // when
            target.Execute(mockContext);

            // then
            mockContext.Received(1).RequestShutdown();
            _ = mockContext.Received(2).IsShutdownRequested;
        }
        public void TheShutdownStateIsAlwaysTheSameReference()
        {
            //given
            var target = new BeaconSendingTerminalState();

            // when
            var obtained = target.ShutdownState;

            // then
            Assert.That(obtained, Is.Not.Null);
            Assert.That(obtained, Is.SameAs(target));
        }
        public void IsInTerminalStateChecksCurrentState()
        {
            // given
            var target = CreateSendingContext().Build();

            Assert.That(target.IsInTerminalState, Is.False);
            Assert.That(target.CurrentState, Is.InstanceOf <BeaconSendingInitState>());

            var terminalState = new BeaconSendingTerminalState();

            // when
            target.NextState = terminalState;

            // then
            Assert.That(target.IsInTerminalState, Is.False);
            Assert.That(target.CurrentState, Is.InstanceOf <BeaconSendingInitState>());
        }