示例#1
0
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			StringHandler().Write(writeContext, "one");
			MockReadContext readContext = new MockReadContext(writeContext);
			string str = (string)StringHandler().Read(readContext);
			Assert.AreEqual("one", str);
		}
示例#2
0
 public virtual void DoTestReadWrite(bool b)
 {
     var writeContext = new MockWriteContext(Db());
     BooleanHandler().Write(writeContext, b);
     var readContext = new MockReadContext(writeContext);
     var res = (bool) BooleanHandler().Read(readContext);
     Assert.AreEqual(b, res);
 }
示例#3
0
		public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            DateTime expected = new DateTime();
            DateTimeHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            DateTime actual = (DateTime)DateTimeHandler().Read(readContext);
            Assert.AreEqual(expected, actual);
        }
示例#4
0
 public virtual void TestReadWrite()
 {
     var writeContext = new MockWriteContext(Db());
     sbyte expected = 0x11;
     SByteHandler().Write(writeContext, expected);
     var readContext = new MockReadContext(writeContext);
     var sbyteValue = (sbyte) SByteHandler().Read(readContext);
     Assert.AreEqual(expected, sbyteValue);
 }
示例#5
0
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			float expected = float.MaxValue;
			FloatHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			float f = (float)FloatHandler().Read(readContext);
			Assert.AreEqual(expected, f);
		}
示例#6
0
 public virtual void TestReadWrite()
 {
     MockWriteContext writeContext = new MockWriteContext(Db());
     ulong expected = 0x1122334455667788;
     ULongHandler().Write(writeContext, expected);
     MockReadContext readContext = new MockReadContext(writeContext);
     ulong ulongValue = (ulong)ULongHandler().Read(readContext);
     Assert.AreEqual(expected, ulongValue);
 }
示例#7
0
 public virtual void TestReadWrite()
 {
     var writeContext = new MockWriteContext(Db());
     ushort expected = 0x1122;
     UShortHandler().Write(writeContext, expected);
     var readContext = new MockReadContext(writeContext);
     var ushortValue = (ushort) UShortHandler().Read(readContext);
     Assert.AreEqual(expected, ushortValue);
 }
示例#8
0
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			long expected = unchecked((long)(0x1020304050607080l));
			LongHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			long longValue = (long)LongHandler().Read(readContext);
			Assert.AreEqual(expected, longValue);
		}
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			int expected = 100;
			IntHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			int intValue = (int)IntHandler().Read(readContext);
			Assert.AreEqual(expected, intValue);
		}
示例#10
0
 public virtual void TestReadWrite()
 {
     var writeContext = new MockWriteContext(Db());
     short expected = unchecked(0x1020);
     ShortHandler().Write(writeContext, expected);
     var readContext = new MockReadContext(writeContext);
     var shortValue = (short) ShortHandler().Read(readContext);
     Assert.AreEqual(expected, shortValue);
 }
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			char expected = (char)unchecked((int)(0x4e2d));
			CharHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			char charValue = (char)CharHandler().Read(readContext);
			Assert.AreEqual(expected, charValue);
		}
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			byte expected = (byte)unchecked((int)(0x61));
			ByteHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			byte byteValue = (byte)ByteHandler().Read(readContext);
			Assert.AreEqual(expected, byteValue);
		}
示例#13
0
		public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            decimal expected = Decimal.MaxValue;
            DecimalHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            decimal decimalValue = (decimal)DecimalHandler().Read(readContext);
            Assert.AreEqual(expected, decimalValue);
        }
示例#14
0
 public virtual void TestReadWrite()
 {
     MockWriteContext writeContext = new MockWriteContext(Db());
     uint expected = 0x11223344;
     UIntHandler().Write(writeContext, expected);
     MockReadContext readContext = new MockReadContext(writeContext);
     uint uintValue = (uint)UIntHandler().Read(readContext);
     Assert.AreEqual(expected, uintValue);
 }
示例#15
0
        public virtual void TestReadWrite()
        {
            var writeContext = new MockWriteContext(Db());

            StringHandler().Write(writeContext, "one");
            var readContext = new MockReadContext(writeContext);
            var str         = (string)StringHandler().Read(readContext);

            Assert.AreEqual("one", str);
        }
示例#16
0
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			DoubleHandler doubleHandler = (DoubleHandler)_handler;
			double expected = 1.23456789;
			doubleHandler.Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			double d = (double)doubleHandler.Read(readContext);
			Assert.AreEqual(expected, d);
		}
        public virtual void DoTestReadWrite(bool b)
        {
            MockWriteContext writeContext = new MockWriteContext(Db());

            BooleanHandler().Write(writeContext, b);
            MockReadContext readContext = new MockReadContext(writeContext);
            bool            res         = (bool)BooleanHandler().Read(readContext);

            Assert.AreEqual(b, res);
        }
        public virtual void TestStringArrayReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());

            string[] expected = new string[] { "one", "two", "three" };
            StringArrayHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);

            string[] actual = (string[])StringArrayHandler().Read(readContext);
            ArrayAssert.AreEqual(expected, actual);
        }
示例#19
0
        public virtual void TestReadWrite()
        {
            var writeContext = new MockWriteContext(Db());
            var expected     = unchecked (0x1020304050607080l);

            LongHandler().Write(writeContext, expected);
            var readContext = new MockReadContext(writeContext);
            var longValue   = (long)LongHandler().Read(readContext);

            Assert.AreEqual(expected, longValue);
        }
        public virtual void TestIntArrayReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());

            int[] expected = new int[] { 7, 8, 9 };
            IntArrayHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);

            int[] actual = (int[])IntArrayHandler().Read(readContext);
            ArrayAssert.AreEqual(expected, actual);
        }
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            byte             expected     = (byte)unchecked ((int)(0x61));

            ByteHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            byte            byteValue   = (byte)ByteHandler().Read(readContext);

            Assert.AreEqual(expected, byteValue);
        }
示例#22
0
        public virtual void TestReadWrite()
        {
            var writeContext = new MockWriteContext(Db());
            var expected     = float.MaxValue;

            FloatHandler().Write(writeContext, expected);
            var readContext = new MockReadContext(writeContext);
            var f           = (float)FloatHandler().Read(readContext);

            Assert.AreEqual(expected, f);
        }
示例#23
0
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            short            expected     = (short)unchecked ((int)(0x1020));

            ShortHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            short           shortValue  = (short)ShortHandler().Read(readContext);

            Assert.AreEqual(expected, shortValue);
        }
示例#24
0
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            char             expected     = (char)unchecked ((int)(0x4e2d));

            CharHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            char            charValue   = (char)CharHandler().Read(readContext);

            Assert.AreEqual(expected, charValue);
        }
示例#25
0
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());
            int expected = 100;

            IntHandler().Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            int             intValue    = (int)IntHandler().Read(readContext);

            Assert.AreEqual(expected, intValue);
        }
示例#26
0
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext  = new MockWriteContext(Db());
            DoubleHandler    doubleHandler = (DoubleHandler)_handler;
            double           expected      = 1.23456789;

            doubleHandler.Write(writeContext, expected);
            MockReadContext readContext = new MockReadContext(writeContext);
            double          d           = (double)doubleHandler.Read(readContext);

            Assert.AreEqual(expected, d);
        }
		public virtual void TestReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			MultiDimensionalArrayHandlerTestCase.Item expected = new MultiDimensionalArrayHandlerTestCase.Item
				(ArrayData);
			IntArrayHandler().Write(writeContext, expected._int);
			MockReadContext readContext = new MockReadContext(writeContext);
			int[][] arr = (int[][])IntArrayHandler().Read(readContext);
			MultiDimensionalArrayHandlerTestCase.Item actualValue = new MultiDimensionalArrayHandlerTestCase.Item
				(arr);
			Assert.AreEqual(expected, actualValue);
		}
 public virtual void TestReadWrite()
 {
     var writeContext = new MockWriteContext(Db());
     var expected = new Item
         (ArrayData);
     IntArrayHandler().Write(writeContext, expected._int);
     var readContext = new MockReadContext(writeContext);
     var arr = (int[][]) IntArrayHandler().Read(readContext);
     var actualValue = new Item
         (arr);
     Assert.AreEqual(expected, actualValue);
 }
        public virtual void TestReadWrite()
        {
            var writeContext = new MockWriteContext(Db());
            var expected     = new Item
                                   (ArrayData);

            IntArrayHandler().Write(writeContext, expected._int);
            var readContext = new MockReadContext(writeContext);
            var arr         = (int[][])IntArrayHandler().Read(readContext);
            var actualValue = new Item
                                  (arr);

            Assert.AreEqual(expected, actualValue);
        }
示例#30
0
        public virtual void TestReadWrite()
        {
            MockWriteContext writeContext = new MockWriteContext(Db());

            MultiDimensionalArrayHandlerTestCase.Item expected = new MultiDimensionalArrayHandlerTestCase.Item
                                                                     (ArrayData);
            IntArrayHandler().Write(writeContext, expected._int);
            MockReadContext readContext = new MockReadContext(writeContext);

            int[][] arr = (int[][])IntArrayHandler().Read(readContext);
            MultiDimensionalArrayHandlerTestCase.Item actualValue = new MultiDimensionalArrayHandlerTestCase.Item
                                                                        (arr);
            Assert.AreEqual(expected, actualValue);
        }
		public virtual void TestStringArrayReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			string[] expected = new string[] { "one", "two", "three" };
			StringArrayHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			string[] actual = (string[])StringArrayHandler().Read(readContext);
			ArrayAssert.AreEqual(expected, actual);
		}
		public virtual void TestIntArrayReadWrite()
		{
			MockWriteContext writeContext = new MockWriteContext(Db());
			int[] expected = new int[] { 7, 8, 9 };
			IntArrayHandler().Write(writeContext, expected);
			MockReadContext readContext = new MockReadContext(writeContext);
			int[] actual = (int[])IntArrayHandler().Read(readContext);
			ArrayAssert.AreEqual(expected, actual);
		}