Wednesday, April 28, 2004

Let's consider a simple fixture with a unit test that must throw. In this case, we use the ExpectedExceptionAttribute to tell the framework that the method should throw:

[TestFixture]
public class MyFixture
{
    [Test]
    [ExpectedException(typeof(Exception))]
    public void ThisMethodThrows()
    { ... }
}

ExpectedExceptionAttrribute is called a Decorator attribute because it decorates and alter the behavior of a test. Another commonly used decorator is IgnoreAttribute to ignore a test.

In MbUnit, other decorators are available. Here I describe two of those: RepeatAttribute and ThreadedRepeatAttribute. RepeatAttribute will make the execution of the test repeated the desired number of times in the same thread while ThreadedRepeatAttribute will launch simultaneously a desired number of threads that will execute the method. RepeatAttribute create a sequence of execution, ThreadedRepeatAttribute create a parallel execution.

    [Test]
    [Repeat(10)] // this will make the RepeatedTest executed 10 times
    public void RepeatedTest()
    { ... }


    [Test]
    [ThreadedRepeat(10)] // this will make the RepeatedTest executed in 10 concurent threads
    public void AmIThreadSake()
    { ... }

Decorators are chained internally in the order that they are defined, therefore declaration order is important if you want to combine them. For example, the two following test methods have different signification:

  • RepeatAndThrow means: repeat test 10 times, test should throw at each execution
  • ThrowWhileRepeating: repeat test 10 times, one of the test should throw during the repetition
    [Test]
    [Repeat(10)]
    [ExpectedException(typeof(Exception))]
    public void RepeatAndThrow()
    { ... }

    [Test]
    [ExpectedException(typeof(Exception))]
    [Repeat(10)]
    public void ThrowWhileRepeating()
    { ... }

posted on Thursday, April 29, 2004 12:51:00 AM UTC  #    Comments [2]
Tracked by:
http://www.google.com/search?q=sdszayot [Pingback]
http://www.google.com/search?q=adcbtgdc [Pingback]
http://powerlance.com/template/misc/2/dietpillphentermine.htm [Pingback]
http://buildguide.net/forum/templates/subRed/3/pharmacy.htm [Pingback]
http://powerlance.com/template/misc/4/order-hydrocodone.htm [Pingback]
http://buildguide.net/forum/templates/subRed/4/buy-viagra-online.htm [Pingback]
http://chatcake.com/tmp/4/levitrabuy.htm [Pingback]
http://chatcake.com/tmp/3/hoodia-diet-pills.htm [Pingback]
http://urdustan.com/catalog/images/sys/3/ordertramadol.htm [Pingback]
http://urdustan.com/catalog/images/sys/1/vicodin.htm [Pingback]
http://buildguide.net/forum/templates/subRed/4/ambien.htm [Pingback]
http://kitaabghar.com/dir/javascript/1/vitamin.htm [Pingback]
http://pickeringpublishing.com/Bringitonhome/archives/4/buycialisonline.htm [Pingback]
http://e-rat.org/aaarg/images/misc/3/buy-soma.htm [Pingback]
http://pickeringpublishing.com/Bringitonhome/archives/4/vicodin.htm [Pingback]
http://thelosthub.com/templates_c/3/prescription-drug.htm [Pingback]
http://arkarpa.org/joomla/images/misc/3/buyphentermine.htm [Pingback]
http://bluehoney.org/bluehoney/images/base/4/ultramonline.htm [Pingback]
http://thelosthub.com/templates_c/2/weight-loss-program.htm [Pingback]
http://bluehoney.org/bluehoney/images/base/3/online-order-phentermine.htm [Pingback]
http://thelosthub.com/templates_c/3/zyrtec.htm [Pingback]
http://kitaabghar.com/dir/javascript/3/canadian-pharmacy.htm [Pingback]
http://arkarpa.org/joomla/images/misc/1/ambien.htm [Pingback]
http://thelosthub.com/templates_c/4/ultram-online.htm [Pingback]
http://thelosthub.com/templates_c/4/phentermineprescription.htm [Pingback]
http://programmazioneneurolinguistica.com/feeds/3/buyvaliumonline.htm [Pingback]
http://buildguide.net/forum/templates/subRed/2/viagra-by-money-order.htm [Pingback]
http://programmazioneneurolinguistica.com/feeds/2/viagra-pill.htm [Pingback]
http://chatcake.com/tmp/3/canadian-pharmacy.htm [Pingback]
http://e-rat.org/aaarg/images/misc/3/order-viagra.htm [Pingback]
http://pickeringpublishing.com/Bringitonhome/archives/1/buy-cialis.htm [Pingback]
http://thelosthub.com/templates_c/2/diet-pill-phentermine.htm [Pingback]
http://arkarpa.org/joomla/images/misc/3/adipex.htm [Pingback]
http://bluehoney.org/bluehoney/images/base/2/vitamin.htm [Pingback]
http://urdustan.com/catalog/images/sys/4/buy-hydrocodone.htm [Pingback]
http://pickeringpublishing.com/Bringitonhome/archives/1/tramadol-online.htm [Pingback]
http://kitaabghar.com/dir/javascript/4/buy-phentermine-cheap.htm [Pingback]
http://bluehoney.org/bluehoney/images/base/4/tramadolultram.htm [Pingback]
http://programmazioneneurolinguistica.com/feeds/2/atkins-diet.htm [Pingback]
http://urdustan.com/catalog/images/sys/2/pharmacy.htm [Pingback]
http://bluehoney.org/bluehoney/images/base/3/prescription-tramadol.htm [Pingback]
http://powerlance.com/template/misc/1/cheap-cialis.htm [Pingback]
http://chatcake.com/tmp/2/viagra-pill.htm [Pingback]
http://powerlance.com/template/misc/2/prescription-drug.htm [Pingback]
http://powerlance.com/template/misc/3/hydrocodone-online.htm [Pingback]
http://kitaabghar.com/dir/javascript/4/diabetic-diet.htm [Pingback]
http://urdustan.com/catalog/images/sys/3/buyphentermine.htm [Pingback]
"precor 9.1 treadmill" (online) [Trackback]
http://localboard.on.ca/GuestBook/public/a/prescription-drug.htm [Pingback]
http://shining.com/store/ph/a/buy-cialis.htm [Pingback]
http://inlay.com/phpBB/cache/misc/c/tramadol-discount.htm [Pingback]
http://inlay.com/phpBB/cache/misc/d/atkinsdiet.htm [Pingback]
http://localboard.on.ca/GuestBook/public/b/buy-online-soma.htm [Pingback]
http://alsysinc.com/images/Image/c/hoodia-diet-pills.htm [Pingback]
http://alsysinc.com/images/Image/b/buyvicodin.htm [Pingback]
http://www.eufos-vienna2007.org/fileadmin/template/css/d/walgreens-drug-store.ht... [Pingback]
http://www.dezwei.at/coppermine/albums/b/how-to-pass-a-drug-test.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/c/spyware-doctor.htm [Pingback]
http://www.dezwei.at/coppermine/albums/c/walgreensdrugstore.htm [Pingback]
http://getindyknow.com/components/com_mymenu/3/tramadol-discount.htm [Pingback]
http://www.eea-esem2006.org/fileadmin/b/tramadolonline.htm [Pingback]
http://getindyknow.com/components/com_mymenu/1/weight-loss-program.htm [Pingback]
http://helpthemknow.com/phplist/attachments/c/propecia-online.htm [Pingback]
http://helpthemknow.com/phplist/attachments/b/viagrapill.htm [Pingback]
http://shining.com/store/ph/b/buy-soma.htm [Pingback]
http://localboard.on.ca/GuestBook/public/c/tramadoldiscount.htm [Pingback]
http://shining.com/store/ph/c/cheapviagra.htm [Pingback]
http://shining.com/store/ph/b/vicodin.htm [Pingback]
http://www.eufos-vienna2007.org/fileadmin/template/css/a/unitedhealthcare.htm [Pingback]
http://helpthemknow.com/phplist/attachments/c/propecia-prescription.htm [Pingback]
http://www.eufos-vienna2007.org/fileadmin/template/css/b/orderpropecia.htm [Pingback]
http://shop.trovata.com/images/misc/4/meridia-weight-loss.htm [Pingback]
http://localboard.on.ca/GuestBook/public/a/buy-propecia.htm [Pingback]
http://localboard.on.ca/GuestBook/public/d/buy-xanax-on-line.htm [Pingback]
http://localboard.on.ca/GuestBook/public/a/weight-loss-program.htm [Pingback]
http://www.dezwei.at/coppermine/albums/a/purchasephentermine.htm [Pingback]
http://shop.trovata.com/images/misc/2/hoodia-diet-pills.htm [Pingback]
http://helpthemknow.com/phplist/attachments/c/meridia-weight-loss.htm [Pingback]
http://localboard.on.ca/GuestBook/public/d/atkins-diet.htm [Pingback]
http://shop.trovata.com/images/misc/2/viagrapill.htm [Pingback]
http://inlay.com/phpBB/cache/misc/c/cvs-pharmacy.htm [Pingback]
http://localboard.on.ca/GuestBook/public/a/drug.htm [Pingback]
http://helpthemknow.com/phplist/attachments/a/weightlosstip.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/d/purchase-phentermine.htm [Pingback]
http://shop.trovata.com/images/misc/1/buy-vicodin.htm [Pingback]
http://www.ballunspitze.com/captcha/b/meridiaweightloss.htm [Pingback]
http://inlay.com/phpBB/cache/misc/c/ultram-online.htm [Pingback]
http://shining.com/store/ph/a/weight-loss.htm [Pingback]
http://www.eea-esem2006.org/fileadmin/d/diet-pills.htm [Pingback]
http://localboard.on.ca/GuestBook/public/c/effexor.htm [Pingback]
http://shop.trovata.com/images/misc/3/zone-diet.htm [Pingback]
http://localboard.on.ca/GuestBook/public/c/buy-valium-online.htm [Pingback]
http://helpthemknow.com/phplist/attachments/b/zonediet.htm [Pingback]
http://www.ballunspitze.com/captcha/c/weight-loss-supplement.htm [Pingback]
http://shining.com/store/ph/a/levitra.htm [Pingback]
http://shining.com/store/ph/b/xanax.htm [Pingback]
http://shop.trovata.com/images/misc/2/cabbage-soup-diet.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/a/alternatives-to-viagra.htm [Pingback]
http://shining.com/store/ph/d/cheaptramadol.htm [Pingback]
http://www.eea-esem2006.org/fileadmin/c/generic-viagra.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/d/lipitor-zocor.htm [Pingback]
http://alsysinc.com/images/Image/b/drug.htm [Pingback]
http://www.eufos-vienna2007.org/fileadmin/template/css/a/purchasephentermine.htm [Pingback]
http://www.ballunspitze.com/captcha/c/unitedhealthcare.htm [Pingback]
http://www.eea-esem2006.org/fileadmin/b/fioricet.htm [Pingback]
http://www.ballunspitze.com/captcha/a/soma-cruz.htm [Pingback]
http://shining.com/store/ph/c/valium.htm [Pingback]
http://www.eufos-vienna2007.org/fileadmin/template/css/c/weightlossproduct.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/a/healthydiet.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/b/weight-loss-product.htm [Pingback]
http://www.alpenhof.it/fileadmin/inc/c/cheap-meridia.htm [Pingback]
http://www.ballunspitze.com/captcha/b/best-prices-on-phentermine.htm [Pingback]
http://www.eea-esem2006.org/fileadmin/d/buycialisonline.htm [Pingback]
http://www.dezwei.at/coppermine/albums/b/order-propecia.htm [Pingback]
http://www.ballunspitze.com/captcha/a/propecia-online.htm [Pingback]
http://alsysinc.com/images/Image/c/cheap-price-viagra.htm [Pingback]
http://karenclarkphotography.com/clientgallery/a/alprazolam.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/b/buyviagraonline.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/a/buycarisoprodol.htm [Pingback]
http://parmleyphotography.com/images/d/buy-online-soma.htm [Pingback]
http://sapid-club.com/soap/base/d/viagraonline.htm [Pingback]
http://airport.by/drupal/files/b/weightloss.htm [Pingback]
http://kathywolfephotography.com/site_images/sec_photos/d/atkins-diet.htm [Pingback]
http://airport.by/drupal/files/b/tramadol-online.htm [Pingback]
http://parmleyphotography.com/images/a/prescriptiondrug.htm [Pingback]
http://sapid-club.com/soap/base/c/valium.htm [Pingback]
http://sapid-club.com/soap/base/a/generic-viagra.htm [Pingback]
http://actionhouse.net/shop/a/propeciaprescription.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/a/levitra.htm [Pingback]
http://sapid-club.com/soap/base/d/paxil.htm [Pingback]
http://kathywolfephotography.com/site_images/sec_photos/d/best-diet-pills.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/d/paxil.htm [Pingback]
http://airport.by/drupal/files/b/buy-cialis-online.htm [Pingback]
http://ligakvn.de/new/images/d/diet-plan.htm [Pingback]
http://kathywolfephotography.com/site_images/sec_photos/d/canadian-pharmacy.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/d/diet-pills.htm [Pingback]
http://actionhouse.net/shop/d/weight-loss-supplement.htm [Pingback]
http://tuttlemedia.com/images/main_page/b/weight-loss-tip.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/c/buyvalium.htm [Pingback]
http://ligakvn.de/new/images/a/alprazolam.htm [Pingback]
http://tlcwe.com/cerberus-gui/templates_c/a/xenical.htm [Pingback]
http://karenclarkphotography.com/clientgallery/b/buy-xanax-on-line.htm [Pingback]
http://ligakvn.de/new/images/c/meridiaonline.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/c/effexor.htm [Pingback]
http://ligakvn.de/new/images/c/buy-vicodin.htm [Pingback]
http://karenclarkphotography.com/clientgallery/b/viagra-prescriptions.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/b/cheap-viagra.htm [Pingback]
http://parmleyphotography.com/images/a/buy-propecia.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/c/cialis-online.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/c/health.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/a/prescriptiondrug.htm [Pingback]
http://iseu.by/board/Packages/c/propecia.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/c/zyrtec.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/b/diet-pill-phentermine.htm [Pingback]
http://tlcwe.com/cerberus-gui/templates_c/b/drug.htm [Pingback]
http://sapid-club.com/soap/base/b/buy-viagra-online.htm [Pingback]
http://iseu.by/board/Packages/d/buyphentermine.htm [Pingback]
http://egmsys.com/pmwiki/wiki.d/base/d/buyonlinesoma.htm [Pingback]
http://karenclarkphotography.com/clientgallery/c/cabbage-soup-diet.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/d/nexium.htm [Pingback]
http://karenclarkphotography.com/clientgallery/a/xenical.htm [Pingback]
http://parmleyphotography.com/images/c/ultram-online.htm [Pingback]
http://tlcwe.com/cerberus-gui/templates_c/c/tramadol-discount.htm [Pingback]
http://airport.by/drupal/files/d/paxil.htm [Pingback]
http://actionhouse.net/shop/b/cheep-phentermine.htm [Pingback]
http://parmleyphotography.com/images/d/tramadoldiscount.htm [Pingback]
http://actionhouse.net/shop/d/alternatives-to-viagra.htm [Pingback]
http://ligakvn.de/new/images/b/hydrocodone-online.htm [Pingback]
http://glamourshades.com/drupal/files/b/weight-loss-tip.htm [Pingback]
http://parmleyphotography.com/images/d/phentermineprescription.htm [Pingback]
http://ligakvn.de/new/images/b/healthandbeauty.htm [Pingback]
http://tlcwe.com/cerberus-gui/templates_c/d/tramadol-ultram.htm [Pingback]
http://glamourshades.com/drupal/files/c/healthfoodstore.htm [Pingback]
http://tlcwe.com/cerberus-gui/templates_c/d/effexor.htm [Pingback]
http://kathywolfephotography.com/site_images/sec_photos/a/effexor.htm [Pingback]
http://iseu.by/board/Packages/d/order-cialis.htm [Pingback]
http://www.google.com/search?q=cecvwpky [Pingback]
http://sapid-club.com/soap/base/d/dietpills.htm [Pingback]
http://glamourshades.com/drupal/files/d/weight-loss-supplement.htm [Pingback]
http://ligakvn.de/new/images/b/buy-valium-online.htm [Pingback]
http://scripts.tlcwe.com/kbase/manage/backup/c/buy-soma.htm [Pingback]
http://kathywolfephotography.com/site_images/sec_photos/c/zone-diet.htm [Pingback]
http://actionhouse.net/shop/d/diabetic-diet.htm [Pingback]
http://ligakvn.de/new/images/c/phentermine-adipex.htm [Pingback]
http://tuttlemedia.com/images/main_page/a/propecia-prescription.htm [Pingback]
http://glamourshades.com/drupal/files/b/healthy-diet.htm [Pingback]
http://actionhouse.net/shop/a/healthy-diet.htm [Pingback]
http://sapid-club.com/soap/base/a/buy-tramadol.htm [Pingback]
http://glamourshades.com/drupal/files/d/walgreens-drug-store.htm [Pingback]
http://iseu.by/board/Packages/b/paxil.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/b/pharmacy.htm [Pingback]
http://iseu.by/board/Packages/c/buytramadolonline.htm [Pingback]
http://thebadd.org/mailcenter/users/ericp-thebadd.org/b/buy-cialis.htm [Pingback]
http://glamourshades.com/drupal/files/d/unitedhealthcare.htm [Pingback]
http://glamourshades.com/drupal/files/c/levitra-buy.htm [Pingback]
http://actionhouse.net/shop/c/levitra.htm [Pingback]
http://tuttlemedia.com/images/main_page/c/walgreens-drug-store.htm [Pingback]
http://abuw.org/chat/chat/localization/thai/c/propecia.htm [Pingback]
http://madisonjazz.com/manage/snippet-db/c/carisoprodolonline.htm [Pingback]
http://www.google.com/search?q=mvqsjsbo [Pingback]
http://infobear.com/albums/.users/c/paxil.htm [Pingback]
http://infobear.com/albums/.users/a/order-viagra.htm [Pingback]
http://taleea.com/alascripts/alachat/data/a/order-viagra.htm [Pingback]
"vantage homes" (online) [Trackback]
Monday, June 06, 2005 6:10:11 PM UTC
overflow
Monday, June 06, 2005 6:10:12 PM UTC
Peli's Blog
Comments are closed.