• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • NUnit之Attribue詳解(2)

    發表于:2012-02-10來源:博客園作者:甘南點擊數: 標簽:nunit
    三:平臺類 [Culture]:當Culture滿足某條件下,才執行測試,如: [Culture(fr-FR)]:僅當在法文Culture時,執行測試[Culture(Exclude = en,de)]:非英文和德文Culture時,

      三:平臺類

      [Culture]:當Culture滿足某條件下,才執行測試,如:

      [Culture("fr-FR")]:僅當在法文Culture時,執行測試[Culture(Exclude = "en,de")]:非英文和德文Culture時,才執行測試

      復制代碼

      [Platform]:當Platform滿足某條件下,才執行測試,如:

      [Platform("NET-4.0")]:僅當framework版本是4.0時,才執行測試

      復制代碼

      下面是NUnit官網聲稱的,其支持的平臺類型:

    Win Win32 Win32S Windows Win32NT
    WinCE Win95 Win98 WinMe NT3
    NT4 NT5 NT6 Win2K WinXP
    Win2003Server Vista Win2008Server Win2008ServerR2 Windows7
    Unix Linux Net Net-1.0 Net-1.1
    Net-2.0 Net-3.0 Net-3.5 Net-4.0 NetCF
    SSCLI Rotor Mono Mono-1.0 Mono-2.0
    Mono-3.0 Mono-3.5      

      四:其它類

      [Category]:將測試方法分組,NUnit會取出所有的組名,列在Categories中,點擊它可以看到。這提供了另外一種測試用例的運行方法,用戶可以在些選擇某一類的用例進行測試,而不是只能以點擊分單位

      [ExpectedException]:運行時拋出的異常才能預期的行為。

      如果沒有這個Attribute,要測試某些異常時,只能使用Try Catch的方式,而下面的代碼則更為簡潔:

      [Test][ExpectedException(typeof(System.DivideByZeroException))]//發生DivideByZeroException時,測試通過public void Test1(){ int a = 0; int b = 1 / a; PrintConsole

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>