コード例 #1
0
        /// <summary>
        /// Checks the object aginst the xml representation above
        /// </summary>
        /// <param name="obj"></param>
        private void AssertValidXmlRemote(Fakes.ParserRootOne obj)
        {
            Assert.IsNotNull(obj);
            Assert.IsTrue(String.IsNullOrEmpty(obj.Name));

            //Complex-Element
            Assert.IsNotNull(obj.Complex);
            Assert.AreEqual("implemented", obj.Complex.Inheritable);
            Assert.AreEqual(4, obj.Complex.Index);

            //Collection-One
            Assert.IsNotNull(obj.CollectionOne, "No Collection-One data");
            Assert.AreEqual(3, obj.CollectionOne.Count);
            Assert.IsInstanceOfType(obj.CollectionOne[0], typeof(Fakes.ParserInnerComplex));
            Assert.IsInstanceOfType(obj.CollectionOne[1], typeof(Fakes.More.ParserDifferentComplex)); //Different namespace
            Assert.IsInstanceOfType(obj.CollectionOne[2], typeof(Fakes.ParserInnerComplex));          //remote reference
            Assert.AreEqual("ShimFile", obj.CollectionOne[2].Inheritable);                            //Check the inner propeties set in resolver.

            //Default collection

            Assert.IsNotNull(obj.DefaultCollection);
            Assert.AreEqual(2, obj.DefaultCollection.Count);

            Assert.IsInstanceOfType(obj.DefaultCollection[0], typeof(Fakes.More.ParserDifferentComplex));
            Fakes.More.ParserDifferentComplex dif = (Fakes.More.ParserDifferentComplex)obj.DefaultCollection[0];
            Assert.AreEqual((Scryber.Drawing.PDFUnit) 13, dif.Thickness.Left);

            Assert.IsInstanceOfType(obj.DefaultCollection[1], typeof(Fakes.ParserInnerComplex));
            Assert.AreEqual(42, obj.DefaultCollection[1].Index);
            Assert.AreEqual("ShimFile2//xpath/node", obj.DefaultCollection[1].Inheritable); //Check the inner propeties set in resolver.
        }
コード例 #2
0
        /// <summary>
        /// Checks the object aginst the xml representation above
        /// </summary>
        /// <param name="obj"></param>
        private void AssertValidXml2(Fakes.ParserRootOne obj)
        {
            Assert.IsNotNull(obj);
            Assert.IsTrue(String.IsNullOrEmpty(obj.Name));

            //Complex-Element
            Assert.IsNotNull(obj.Complex);
            Assert.AreEqual("implemented", obj.Complex.Inheritable);
            Assert.AreEqual(4, obj.Complex.Index);

            //Collection-One
            Assert.IsNotNull(obj.CollectionOne, "No Collection-One data");
            Assert.AreEqual(3, obj.CollectionOne.Count);
            Assert.IsInstanceOfType(obj.CollectionOne[0], typeof(Fakes.ParserInnerComplex));
            Assert.IsInstanceOfType(obj.CollectionOne[1], typeof(Fakes.More.ParserDifferentComplex)); //Different namespace
            Assert.IsInstanceOfType(obj.CollectionOne[2], typeof(Fakes.ParserInnerComplex));

            //Default collection

            Assert.IsNotNull(obj.DefaultCollection);
            Assert.AreEqual(2, obj.DefaultCollection.Count);

            Assert.IsInstanceOfType(obj.DefaultCollection[0], typeof(Fakes.More.ParserDifferentComplex));
            Fakes.More.ParserDifferentComplex dif = (Fakes.More.ParserDifferentComplex)obj.DefaultCollection[0];
            //Parsing order = Top Right Bottom Left.
            Assert.AreEqual((Scryber.Drawing.PDFUnit) 13, dif.Thickness.Left);

            Assert.IsInstanceOfType(obj.DefaultCollection[1], typeof(Fakes.ParserInnerComplex));
            Assert.AreEqual(42, obj.DefaultCollection[1].Index);
        }