Exemplo n.º 1
0
        public void PerformTest <T>(
            Func <Int64, T> convert,
            WriteWithRef <T> write,
            ReadWithRef <T> read,
            WriteWithoutRef <T> writeNoRef,
            ReadWithoutRef <T> readNoRef
            )
        {
            var val = convert(this.Value);

            PerformTestWithRef(val, write, read);
            PerformTestWithoutRef(val, writeNoRef, readNoRef);
        }
Exemplo n.º 2
0
 public static void PerformTest <T>(
     this ByteArraySerializationFuzzyTestPerformer performer,
     Func <Int64, T> convert,
     WriteWithRef <T> writeLE,
     ReadWithRef <T> readLE,
     WriteWithoutRef <T> writeNoRefLE,
     ReadWithoutRef <T> readNoRefLE,
     WriteWithRef <T> writeBE,
     ReadWithRef <T> readBE,
     WriteWithoutRef <T> writeNoRefBE,
     ReadWithoutRef <T> readNoRefBE
     )
 {
     performer.PerformTest(convert, writeLE, readLE, writeNoRefLE, readNoRefLE);
     performer.PerformTest(convert, writeBE, readBE, writeNoRefBE, readNoRefBE);
 }
Exemplo n.º 3
0
        private static void PerformTestWithRef <T>(
            T val,
            WriteWithRef <T> write,
            ReadWithRef <T> read
            )
        {
            var size  = Marshal.SizeOf <T>();
            var array = new Byte[size];
            var idx   = 0;

            write(array, ref idx, val);
            Assert.AreEqual(size, idx);
            idx = 0;
            var deserialized = read(array, ref idx);

            Assert.AreEqual(size, idx);
            Assert.AreEqual(deserialized, val, "Value was different for methods: " + write.Method + ", " + read.Method);
        }