예제 #1
0
        public void StandardNonPublicSerializableClassTest()
        {
            var model = new StandardNonPublicSerializableClassModel
            {
                IntValue            = 0x12345678,
                InternalIntValue    = 0x76543210,
                StringValue         = "ABCDEFG",
                InternalStringValue = "GFEDCBA"
            };

            using (var ms = new MemoryStream())
            {
                ms.WriteValue(model);

                Assert.IsTrue(
                    ms.ToArray().SequenceEqual(new byte[]
                {
                    0x01,
                    0x78, 0x56, 0x34, 0x12,
                    0x10, 0x32, 0x54, 0x76,
                    0x07, 0x00,
                    (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
                    0x07, 0x00,
                    (byte)'G', (byte)'F', (byte)'E', (byte)'D', (byte)'C', (byte)'B', (byte)'A'
                }));
            }
        }
		public void StandardNonPublicSerializableClassTest()
		{
			var model = new StandardNonPublicSerializableClassModel
			{
				IntValue = 0x12345678,
				InternalIntValue = 0x76543210,
				StringValue = "ABCDEFG",
				InternalStringValue = "GFEDCBA"
			};

			using (var ms = new MemoryStream())
			{
				ms.WriteValue(model);

				Assert.IsTrue(
					ms.ToArray().SequenceEqual(new byte[]
					{
						0x01,
						0x78, 0x56, 0x34, 0x12,
						0x10, 0x32, 0x54, 0x76,
						0x07, 0x00,
						(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
						0x07, 0x00,
						(byte)'G', (byte)'F', (byte)'E', (byte)'D', (byte)'C', (byte)'B', (byte)'A'
					}));
			}
		}