Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionIfUnrecognizedObjectIsFound()
        public virtual void ShouldThrowExceptionIfUnrecognizedObjectIsFound()
        {
            try
            {
                RaftMessageComposer raftMessageComposer = new RaftMessageComposer(Clock.systemUTC());

                raftMessageComposer.Decode(null, "a string", null);
            }
            catch (System.InvalidOperationException e)
            {
                assertThat(e.Message, equalTo("Unexpected object in the pipeline: a string"));
                return;
            }
            fail();
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionOnConflictingMessageHeaders()
        public virtual void ShouldThrowExceptionOnConflictingMessageHeaders()
        {
            try
            {
                RaftMessageComposer raftMessageComposer = new RaftMessageComposer(Clock.systemUTC());

                raftMessageComposer.Decode(null, MessageCreator((a, b) => null), null);
                raftMessageComposer.Decode(null, MessageCreator((a, b) => null), null);
            }
            catch (System.InvalidOperationException e)
            {
                assertThat(e.Message, containsString("Pipeline already contains message header waiting to build."));
                return;
            }
            fail();
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionIfNotAllResourcesAreUsed()
        public virtual void ShouldThrowExceptionIfNotAllResourcesAreUsed()
        {
            try
            {
                RaftMessageComposer raftMessageComposer = new RaftMessageComposer(Clock.systemUTC());

                ReplicatedTransaction replicatedTransaction = ReplicatedTransaction.from(new sbyte[0]);
                raftMessageComposer.Decode(null, replicatedTransaction, null);
                IList <object> @out = new List <object>();
                raftMessageComposer.Decode(null, MessageCreator((a, b) => DummyRequest()), @out);
            }
            catch (System.InvalidOperationException e)
            {
                assertThat(e.Message, containsString("was composed without using all resources in the pipeline. Pipeline still contains Replicated contents"));
                return;
            }
            fail();
        }