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");
        }
Ejemplo n.º 2
0
        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");
        }