WriteInt32() 공개 메소드

public WriteInt32 ( int value ) : void
value int
리턴 void
 public void TestClearBody()
 {
     ActiveMQBytesMessage bytesMessage = new ActiveMQBytesMessage();
     try {
         bytesMessage.WriteInt32(1);
         bytesMessage.ClearBody();
         Assert.IsFalse(bytesMessage.ReadOnlyBody);
         bytesMessage.WriteInt32(1);
         bytesMessage.ReadInt32();
     }
     catch(MessageNotReadableException)
     {
     }
     catch(MessageNotWriteableException)
     {
         Assert.IsTrue(false);
     }
 }
예제 #2
0
	    public void TestWriteOnlyBody() 
		{
	        ActiveMQBytesMessage message = new ActiveMQBytesMessage();
	        message.ClearBody();
	        
			try
			{
	            message.WriteBoolean(true);
	            message.WriteByte((byte) 1);
	            message.WriteBytes(new byte[1]);
	            message.WriteBytes(new byte[3], 0, 2);
	            message.WriteChar('a');
	            message.WriteDouble(1.5);
	            message.WriteSingle((float) 1.5);
	            message.WriteInt32(1);
	            message.WriteInt64(1);
	            message.WriteObject("stringobj");
	            message.WriteInt16((short) 1);
	            message.WriteString("utfstring");
	        }
			catch(MessageNotWriteableException)
			{
	            Assert.Fail("Should be writeable");
	        }
			
	        try
			{
	            message.ReadBoolean();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadByte();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadBytes(new byte[1]);
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadBytes(new byte[2], 2);
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadChar();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadDouble();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try 
			{
	            message.ReadSingle();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadInt32();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadInt64();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadString();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try
			{
	            message.ReadInt16();
	            Assert.Fail("Should have thrown exception");
	        }
			catch(MessageNotReadableException)
			{
	        }
	        
			try 
			{
	            message.ReadString();
	            Assert.Fail("Should have thrown exception");
	        } 
			catch(MessageNotReadableException) 
			{
	        }
	    }		
예제 #3
0
	    public void TestReset() {

			ActiveMQBytesMessage message = new ActiveMQBytesMessage();
	        
			try 
			{
	            message.WriteDouble(24.5);
	            message.WriteInt64(311);
	        } 
			catch(MessageNotWriteableException)
			{
	            Assert.Fail("should be writeable");
	        }
	        
			message.Reset();
	        
			try {
	            Assert.IsTrue(message.ReadOnlyBody);
	            Assert.AreEqual(message.ReadDouble(), 24.5, 0);
	            Assert.AreEqual(message.ReadInt64(), 311);
	        } 
			catch(MessageNotReadableException) 
			{
	            Assert.Fail("should be readable");
	        }
	        
			try
			{
	            message.WriteInt32(33);
	            Assert.Fail("should throw exception");
	        }
			catch(MessageNotWriteableException)
			{
	        }
	    }
예제 #4
0
	    public void TestReadInt() {
	        ActiveMQBytesMessage msg = new ActiveMQBytesMessage();
            msg.WriteInt32(3000);
            msg.Reset();
            Assert.IsTrue(msg.ReadInt32() == 3000);
	    }