Exemplo n.º 1
0
        protected internal virtual States BuildStates()
        {
            ConnectedState   connected   = new ConnectedState();
            ReadyState       ready       = new ReadyState();
            StreamingState   streaming   = new StreamingState();
            FailedState      failed      = new FailedState();
            InterruptedState interrupted = new InterruptedState();

            connected.ReadyState  = ready;
            connected.FailedState = failed;

            ready.StreamingState   = streaming;
            ready.InterruptedState = interrupted;
            ready.FailedState      = failed;

            streaming.ReadyState       = ready;
            streaming.InterruptedState = interrupted;
            streaming.FailedState      = failed;

            failed.ReadyState       = ready;
            failed.InterruptedState = interrupted;

            interrupted.ReadyState  = ready;
            interrupted.FailedState = failed;

            return(new States(connected, failed));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldThrowWhenNotInitialized() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldThrowWhenNotInitialized()
        {
            StreamingState state = new StreamingState();

            assertThrows(typeof(System.InvalidOperationException), () => state.Process(PullAllMessage.INSTANCE, _context));

            state.ReadyState = _readyState;
            assertThrows(typeof(System.InvalidOperationException), () => state.Process(PullAllMessage.INSTANCE, _context));

            state.ReadyState       = null;
            state.InterruptedState = _interruptedState;
            assertThrows(typeof(System.InvalidOperationException), () => state.Process(PullAllMessage.INSTANCE, _context));

            state.InterruptedState = null;
            state.FailedState      = _failedState;
            assertThrows(typeof(System.InvalidOperationException), () => state.Process(PullAllMessage.INSTANCE, _context));
        }