コード例 #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()
        {
            InterruptedState state = new InterruptedState();

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

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

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