Reputation: 11146
I'm using FakeItEasy to mock stuff within unit tests but somehow i fail to setup pretty basic scenario. ie. i want to throw exception when specific user accesses a method. Help would be nice... thanks
A.CallTo(() => m_fancyRepository
.CanIDoFancyThings(A<User>
.That
.Matches(u => u.Id.Equals(m_user.Id)))
.Verify())
.Throws(new Exception("omg !!! ???!"));
Upvotes: 1
Views: 42
Reputation: 4222
Try to remove the Verify()
method after the stub, like this:
A.CallTo(() => m_fancyRepository.CanIDoFancyThings(
A<User>.That.Matches(u => u.Id.Equals(m_user.Id))))
.Throws(new Exception("omg !!! ???!"));
Upvotes: 2