예제 #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));
        }
예제 #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()
        {
            ReadyState state = new ReadyState();

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

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

            state.StreamingState   = 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));
        }