public static void UmaReadWriteStructWithReferenceType_ThrowsArgumentException() { const int capacity = 100; UmaTestStruct_ContainsReferenceType inStruct = new UmaTestStruct_ContainsReferenceType { referenceType = new object() }; using (var buffer = new TestSafeBuffer(capacity)) using (var uma = new UnmanagedMemoryAccessor(buffer, 0, capacity, FileAccess.ReadWrite)) { AssertExtensions.Throws <ArgumentException>(null, "type", () => uma.Write <UmaTestStruct_ContainsReferenceType>(0, ref inStruct)); AssertExtensions.Throws <ArgumentException>(null, "type", () => uma.Read <UmaTestStruct_ContainsReferenceType>(0, out inStruct)); } }
public static void UmaReadWriteStructArrayWithReferenceType_ThrowsArgumentException() { const int capacity = 100; UmaTestStruct_ContainsReferenceType[] structArr = new UmaTestStruct_ContainsReferenceType[1] { new UmaTestStruct_ContainsReferenceType() { referenceType = new object() } }; using (var buffer = new TestSafeBuffer(capacity)) using (var uma = new UnmanagedMemoryAccessor(buffer, 0, capacity, FileAccess.ReadWrite)) { AssertExtensions.Throws <ArgumentException>("type", () => uma.WriteArray <UmaTestStruct_ContainsReferenceType>(0, structArr, 0, 1)); AssertExtensions.Throws <ArgumentException>("type", () => uma.ReadArray <UmaTestStruct_ContainsReferenceType>(0, structArr, 0, 1)); } }
public static void UmaReadWriteStructWithReferenceType_ThrowsArgumentException() { const int capacity = 100; UmaTestStruct_ContainsReferenceType inStruct = new UmaTestStruct_ContainsReferenceType { referenceType = new object() }; using (var buffer = new TestSafeBuffer(capacity)) using (var uma = new UnmanagedMemoryAccessor(buffer, 0, capacity, FileAccess.ReadWrite)) { Assert.Throws<ArgumentException>("type", () => uma.Write<UmaTestStruct_ContainsReferenceType>(0, ref inStruct)); Assert.Throws<ArgumentException>("type", () => uma.Read<UmaTestStruct_ContainsReferenceType>(0, out inStruct)); } }