コード例 #1
0
                /// <summary>
                /// Tests the Content/AllContent methods on Container
                /// </summary>
                /// <param name="context"></param>
                /// <returns></returns>
                //[Variation(Desc = "ContainerContent")]
                public void ContainerContent()
                {
                    XElement element =
                        new XElement("foo",
                                     new XAttribute("att1", "a1"),
                                     new XComment("my comment"),
                                     new XElement("bar", new XText("abcd"), new XElement("inner")),
                                     100);

                    // Content should include just the elements, no attributes
                    // or contents of nested elements.
                    IEnumerator allContent = element.Nodes().GetEnumerator();

                    allContent.MoveNext();
                    object obj1 = allContent.Current;

                    allContent.MoveNext();
                    object obj2 = allContent.Current;

                    allContent.MoveNext();
                    object obj3 = allContent.Current;
                    bool   b    = allContent.MoveNext();

                    Validate.DeepEquals(obj1, new XComment("my comment"));
                    Validate.DeepEquals(obj2, new XElement("bar", new XText("abcd"), new XElement("inner")));
                    Validate.DeepEquals(obj3, new XText("100"));
                    Validate.IsEqual(b, false);
                }