<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 80,comments - 749,trackbacks - 2

    What is NXUnit?

    NXUnit is a NUnit -style unit testing framework about XML for .NET Framework. It is an extension to NUnit. It brings you the ability to do unit testing easily in XML applications. It helps you to concentrate on business logic of your XML application and improve your Test Driven Development(TDD) technics. You can directly compare one XML string or stream with another, er assert that they are equal, just like doing the same thing to two integers using xUnit. But without NXUnit, you must pay attention to whitespaces in XML strings, empty elements or attributes, unimportant order of elements or attributes, unneccessary comments and so on. It's similar with XmlUnit in some aspects.

    Features

    The current version is NXUnit 1.0rc1, July 2005. The following is the 8 features of this version, which you can find in the facade class XMLAssert:

        * Assert that two XML inputs are equal.
        * Compare two XML inputs and find all differences between them.
        * Assert that declarations of two XML inputs are equal.
        * Assert that document types of two XML inputs are equal.
        * Assert the validity of an XML input.
        * Assert that the evaluation of an XPath expression on an XML input will return the expected value.
        * Assert that an XPath expression exists for an XML input.
        * Assert that an XML input is included by another.

    And you can change the properties of an instance of XMLAssert before an assertion or comparition, in order to:

        * Ignore the case of the elements' and attributes' names
        * Ignore XML comments
        * Ignore XML declarations and document types of both inputs
        * Ignore empty elements and attributes
        * Ignore orders of elements and attributes
        * Ignore unimportant whitespaces

    Sample

     1    using System;
     2    using System.IO;
     3    using System.Xml;
     4    using NUnit.Framework;
     5    using NXUnit.Framework;
     6
     7
     8    [TestFixture]
     9    public class Sample
    10    {
    11        private XMLAssert xa;
    12
    13        [SetUp]
    14        public void Init()
    15        {
    16            xa = XMLAssert.CreateInstance();
    17        }

    18
    19        [Test]
    20        public void TestMethod()
    21        {
    22            // Init the xml input
    23            string s1 = "";
    24            string s2 = "";
    25
    26            // Init the options for your purpose
    27            xa.IsOrderSensitive = false;
    28
    29            // Assert two XML inputs are equal
    30            xa.AreEqual(s1, s2, "Assertion Failed!");
    31
    32            // Compare two XML inputs and find all differences between them
    33            CompareResult r = xa.Compare(s1, s2);
    34            foreach (Diff d in r)
    35            {
    36                Console.WriteLine(d);
    37            }

    38            CompareResult another = xa.Compare(s1, s2);
    39            r.Add(another);
    40            for (int i = 0; i < r.Count; i++)
    41            {
    42                Console.WriteLine(r[i]);
    43            }

    44            if (r.AreEqual)
    45            {
    46                // They are equal
    47            }

    48
    49            // Assert two XML declaration of the two XML inputs are equal
    50            xa.AreDeclareEqual(s1, s2, "Declarations are not equal");
    51
    52            // Assert two document types of the two XML inputs are equal
    53            xa.AreDocTypeEqual(s1, s2, "DocTypes are not equal");
    54
    55            // Assert the validity of an XML input
    56            XMLAssert.IsValid("");
    57            XMLAssert.IsValidFile(@"C:\");
    58
    59            // Assert the evaluation of an XPath expression on an XML input will 
    60            // return the expected value
    61            xa.AreXpathEqual("<a/>""/r/a[2]", s1, 
    62                "The xpath expression doesn't return <a/>");
    63
    64            // Assert an XPath expression is exist for an XML input
    65            XMLAssert.XpathExist("//@b='c'", s1, 
    66                "The xml document doesn't have the xpath expression");
    67
    68            // Assert an XML input is included by another one
    69            xa.IsIncluded(s1, s2, "The {0} is not included in {1}", s1, s2);
    70
    71            // The Counter
    72            Assert.AreEqual(6, xa.Counter);
    73
    74            // XMLInput can use in all the samples above
    75            xa.AreEqual(XMLInput.CreateFromString(s1), 
    76                XMLInput.CreateFromString(s2), "Assertion Failed!");
    77        }

    78    }
    posted on 2005-07-15 13:22 Brian Sun 閱讀(2456) 評論(3)  編輯  收藏 所屬分類: 軟件

    FeedBack:
    # re: 發(fā)表我自己的開源軟件
    2005-07-16 21:44 | 乖狗狗
    泡泡啊,終于又見你寫B(tài)log了
    雖然你的著作對乖狗狗來說是比較深奧滴
    還是努力去看看
    呵呵
      回復(fù)  更多評論
      
    # re: 發(fā)表我自己的開源軟件
    2005-07-19 12:37 | Brian Sun
    謝謝支持,呵呵,我會努力的!
      回復(fù)  更多評論
      
    # re: BlogJava的開源軟件:NXUnit
    2014-10-24 10:26 | lovemydream
    TDD!~~  回復(fù)  更多評論
      
    主站蜘蛛池模板: 污视频网站免费在线观看| 精品亚洲福利一区二区| 亚洲黄色片免费看| 一级毛片免费播放试看60分钟| 亚洲激情校园春色| 好吊妞998视频免费观看在线| 国产亚洲欧美日韩亚洲中文色 | 免费一级毛片在线播放放视频 | 亚洲免费二区三区| 亚洲日韩一区二区三区| 亚洲成在人天堂在线| 久久久久无码专区亚洲av| 国产麻豆免费观看91| 亚洲欧美中文日韩视频| 亚洲日韩乱码中文无码蜜桃| 亚洲妇熟XXXX妇色黄| 日日噜噜噜噜夜夜爽亚洲精品 | 亚洲综合精品成人| 亚洲国产精品综合一区在线| 久久精品国产精品亚洲色婷婷| 成人无码区免费视频观看| 51视频精品全部免费最新| 久久香蕉国产线看免费| 国产免费一区二区视频| 高清永久免费观看| 亚洲最大的成人网| 亚洲不卡视频在线观看| 亚洲制服丝袜在线播放| 久久久久国产亚洲AV麻豆| 亚洲福利精品电影在线观看| 一本久久综合亚洲鲁鲁五月天| 国产精品免费视频播放器| 国产成人免费a在线视频色戒| 日韩一区二区免费视频| 国产男女猛烈无遮挡免费视频 | 91在线精品亚洲一区二区| 久久精品国产亚洲AV麻豆网站| 91亚洲va在线天线va天堂va国产 | 国产精品免费无遮挡无码永久视频 | 一级A毛片免费观看久久精品 | 国产产在线精品亚洲AAVV|