chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
When i run this test using TestDriven.net it passes, but with nunit gui it fails. all other test run fine. do you have any ideas:

test:
[Test]
public void RollbackTransactionSucceed()
{
MockManager.Init();

MockObject dbTransactionObjMock = MockManager.MockObject(typeof(DbTransaction));
DbTransaction dbTransaction = (DbTransaction)dbTransactionObjMock.Object;

dbTransactionObjMock.ExpectAndThrow("Commit", new Exception("error"), 1);
dbTransactionObjMock.ExpectCall("Rollback",1);

BaseDal dal = new UserDal();
dal.Transaction = dbTransaction;
bool returnValue = dal.CommitTransaction();
Assert.IsFalse(returnValue);
MockManager.Verify();

}

method:
public bool CommitTransaction()
{
bool committed = false;
try
{
dbTransaction.Commit();
committed = true;
}
catch(Exception)
{
dbTransaction.Rollback();
}
return committed;
}

the error in nunit is:
...RollbackTransactionSucceed : TypeMock.VerifyException :
TypeMock Verification: Method MockDbTransaction.Rollback() has 1 more expected calls
asked by mzelinski (2.2k points)

3 Answers

0 votes
figured it out.
i had 2 projects loaded and assembly conflicts.

but one other question.
do you have plans or any knowledge on how to get TestRunner working in vs 2005 with typemock. it works when i run the test but not when the profiler is on. are you going to support this in the future?
answered by mzelinski (2.2k points)
0 votes
Hi,
Supporting TestRunner is on our future feature list.
answered by scott (32k points)
0 votes
TestRunner is supported in version 3.1
To use the Coverage with TypeMock.NET you will need a Professional or Enterprise Editions
answered by scott (32k points)
...