views:

34

answers:

0

hello everyone

i'm testing method foo() :

[TestClass] class myTestClass
{
myTestClas()
{
var MockedProg = Mocks.Stub<myProg>();
}

>[TestMethod]  
someTestName()  
{  
    using (Mocks.Record())  
    {  
        MockedProg.firstTest();  
        MockedProg.SecondTest();  
        MockedProg.thirdTest();  

        Expect.Call(MockedProg.ResturnResultTest().Return(true));  

        MockedProg.Special();  
    }  
    using (Mocks.Playback())  
    {  
      foo();        
    }  
}  

class myProg
{
foo()
{
try
{
firstTest();
SecondTest();
thirdTest();

    bool res =  ResturnResultTest();  
    if(res)  
    {  
      throw new myException("Very Bad")  
    }  

  }  
  catch (myException ex)
  {  
     Special();  
  }    
}  

}

inside the mothod there is alot of tests.
right now i'm checking the part when 'res' equals true,
and i'm expecting the code on the catch.

on MSTest its just fine.
when it hit the exception it just goes to the catch section and continue.
but when i'm running it on TestDriven, the test ended in failure.

i dont think that Expect.Call(MockedProg.ResturnResultTest().Throw(...))is the answer..

thank alot to all the answers.. :-)