public static void RunUnpackTest(ref TestSettings settings) { TestSettings r1 = null; TestSettings r2 = null; using (var nativeManager = new LocalManager()) { Guid id = Guid.NewGuid(); var nativeResult = nativeManager.BeginInvoke(typeof(TestRunner), "Unpack", id, false, settings); using (var managedManager = new InprocManager()) r2 = (TestSettings)managedManager.Invoke(typeof(TestRunner), "Unpack", id, true, settings); r1 = (TestSettings)nativeManager.EndInvoke(nativeResult); } if (r1.WrittenSize != r2.WrittenSize) throw new InvalidOperationException(); if (r1.UsedSize != r2.UsedSize) throw new InvalidOperationException(); for (int i = 0; i < r1.WrittenSize; i++) if (r1.Dst[i] != r2.Dst[i]) throw new InvalidOperationException(); settings = r1; }
public static void RunPackTest(ref TestSettings settings) { TestSettings r1 = null; TestSettings r2 = null; using (var nativeManager = new LocalManager()) { Guid id = Guid.NewGuid(); var nativeResult = nativeManager.BeginInvoke(typeof(TestRunner), "Pack", id, false, settings); using (var managedManager = new InprocManager()) r2 = (TestSettings)managedManager.Invoke(typeof(TestRunner), "Pack", id, true, settings); r1 = (TestSettings)nativeManager.EndInvoke(nativeResult); } if (r1.WrittenSize != r2.WrittenSize) { throw new InvalidOperationException(); } for (int i = 0; i < r1.WrittenSize; i++) { if (r1.Dst[i] != r2.Dst[i]) { throw new InvalidOperationException(); } } if (r1.Enc.Length != r2.Enc.Length) { throw new InvalidOperationException(); } for (int i = 0; i < r1.Enc.Length; i++) { if (r1.Enc[i] != r2.Enc[i]) { throw new InvalidOperationException(); } } settings = r1; }