public void OnReadOnlyArray_ExceptionIsThrown() { ArrayParent parent = new ArrayParent(); Serializer s = new Serializer(typeof(ArrayParent)); string result = s.Serialize(parent); bool thrown = false; try { ArrayParent actual = (ArrayParent)s.Deserialize(result); } catch (InvalidOperationException) { thrown = true; } Assert.IsTrue(thrown, "Expected InvalidOperationException to be thrown when attempting to update get-only array property"); }
public void OnReadOnlyArray_ExceptionIsThrown() { ArrayParent parent = new ArrayParent(); Serializer s = new Serializer(); string result = s.Serialize(parent); bool thrown = false; try { ArrayParent actual = s.Deserialize <ArrayParent>(result); } catch (InvalidOperationException) { thrown = true; } Assert.IsTrue(thrown, "Expected InvalidOperationException to be thrown when attempting to update get-only array property"); }