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
Incorrect error message for WasCalledWithExactArguments when not called.

Here's the production code:
    public class DoSendEmail
    {
        public void SendEmail()
        {
            return;


        }
    }


Here's the test code
        [Test, Isolated]
        public void DoubleTake()
        {
            SmtpClient smtpFake = Isolate.Fake.Instance<SmtpClient>(Members.ReturnRecursiveFakes);
            Isolate.Swap.NextInstance<SmtpClient>().With(smtpFake);
            MailMessage mailMessage = Isolate.Fake.Instance<MailMessage>(Members.CallOriginal);
            DoSendEmail op = new DoSendEmail();

            op.SendEmail();
            Isolate.Verify.WasCalledWithExactArguments(() => smtpFake.Send(mailMessage));
        }


And here's the error message:
failed: TypeMock.VerifyException : 
TypeMock Verification: Method System.Net.Mail.SmtpClient.Send() was expected but was not called
   at e0.b(ag A_0, b8 A_1)
   at e0.e(Delegate A_0)
   at e0.c(Action A_0)


It should be smtpFake.Send(mailMessage), not SmtpClient.Send()
________
Ffm video
asked by nsoonhui (59.1k points)

1 Answer

0 votes
I agree that the exception message is less than ideal.
We will fix this in the upcoming version of Typemock Isolator
answered by dhelper (11.9k points)
...