user3322301
user3322301

Reputation: 31

ApprovalTests failing when files are identical

im using approvals verify in c#

Approvals.Verify(player.ToString());

and it opens in code compare and even when I copy it over it is still failing.

why is it doing this and how can I fix it?

Upvotes: 3

Views: 1383

Answers (1)

llewellyn falco
llewellyn falco

Reputation: 2351

This is most likely an issue with encoding of the two files (received vs approved).

Side note: probably 1 is UTF-8 and the other is Ascii. Different diff tools will handle it differently, although in the end approvaltests wants UTF-8 everywhere.

The Best way to solve this is to copy the received file over to the approved file. You can do this manually, but it is easier to use the ClipboardReporter which will automatically add the command line to your clipboard copy/paste buffer

[UseReporter(typeof(ClipboardReporter))]

Then

  1. run the test
  2. open a command prompt (winkey+r, cmd)
  3. paste (right click then select paste, the stand ctrl+c doesn't work here)
  4. hit enter

Happy Testing!

Upvotes: 3

Related Questions