eba
eba

Reputation: 673

asp mvc 2 unit test debug

my code

[TestMethod()]
    public void SelectTest()
    {
        DateTime begin = new DateTime(); // TODO: инициализация подходящего значения
        DateTime end = new DateTime(); // TODO: инициализация подходящего значения
        int agrNum = 0; // TODO: инициализация подходящего значения
        Core.Core.Select(begin, end, agrNum);
        Assert.Inconclusive("Невозможно проверить метод, не возвращающий значение.");
    }

i'm pressing "debug test" button. when Core.Core.Select gets exception, execution of test fails, and intest results i'm getting information about exception. how can i force him to break on exception, and show me information??? vs2010 ultimate, win xp sp3 32bit

Upvotes: 1

Views: 182

Answers (2)

Maxim Gueivandov
Maxim Gueivandov

Reputation: 2375

Try this:

  1. In Visual Studio main menu, click on Debug -> Exceptions...
  2. Enable breaking on all thrown CLR exceptions (or refine that rule by selecting specific exception types), like shown below:

enter image description here

Upvotes: 2

SadullahCeran
SadullahCeran

Reputation: 2435

Put try {} catch {} clouse around Core.Core.Select statement:

[TestMethod()]
    public void SelectTest()
    {
        DateTime begin = new DateTime(); // TODO: инициализация подходящего значения
        DateTime end = new DateTime(); // TODO: инициализация подходящего значения
        int agrNum = 0; // TODO: инициализация подходящего значения
        try{
            Core.Core.Select(begin, end, agrNum);
        }
        catch(Exception){}
        Assert.Inconclusive("Невозможно проверить метод, не возвращающий значение.");
    }

Upvotes: 0

Related Questions