Exemplo n.º 1
0
        public void CanDeserializeFromStream()
        {
            using (var s = ResourceHelper.GetResource("CanDeserializeFromStream_ActionResult.xml"))
            {
                var ar = ActionResult.Deserialize(s);

                Assert.IsNotNull(ar);
                Assert.IsNotNull(ar.ResultSets);
                Assert.AreEqual(1, ar.ResultSets.Count);
                Assert.IsNotNull(ar.ResultSets[0]);
                Assert.IsNotNull(ar.ResultSets[0].Schema);
                Assert.IsNotNull(ar.ResultSets[0].Rows);
                Assert.AreEqual(2, ar.ResultSets[0].Rows.Count);
            }
        }
Exemplo n.º 2
0
        public void CannotDeserializeFromStreamWithIncorrectSchema()
        {
            using (var s = ResourceHelper.GetResource("CanDeserializeFromStream_ActionResult_IncorrectSchema.xml"))
            {
                try

                {
                    ActionResult.Deserialize(s);
                }
                catch (Exception ex)
                {
                    Assert.AreSame(typeof(InvalidOperationException), ex.GetType());
                    Assert.IsNotNull(ex.InnerException);
                    Assert.AreSame(typeof(XmlSchemaValidationException), ex.InnerException.GetType());
                    return;
                }

                Assert.Fail("Expected exception was not thrown");
            }
        }
Exemplo n.º 3
0
 public void CannotDeserializeFromNullStream()
 {
     ActionResult.Deserialize(null);
 }