Closed mikeu closed 2 years ago
Thank you for using Moq.ILogger and for submitting this issue. This has been fixed in 1.1.10
Thanks @adrianiftode for the great library and quick response! I can confirm that with version 1.1.10 installed my tests are now working as intended.
I started adding
Moq.ILogger
to my test project this afternoon, and so far am very happy with it, thank you! However, while updating one of my tests, I encountered the following exception:My intention was to allow the test to still pass if the order in which the parameters passed to the log statement changed. For example, switching the logged message from
("The {Foo} received {Bar}", foo, bar)
to("{Bar} was sent to the {Foo}", bar, foo)
should not cause the test to fail.To that end, I was attempting to grab the
object[]
array of params and verify that it contained bothFoo
andBar
, without caring about order.Here is a sample of the test that led to the above exception:
This seems to be the same general problem as in #3, but with different source and target types for the cast. I can resolve it by switching the constant string passed as the first argument to
It.IsAny<string>()
, orIt.Is<string>(s => conditions(s))
, which is fine for my use case, but wanted to report the unexpected exception to you as requested!I'm using v1.1.9, with Moq 4.16.1. Please let me know if there are any additional details that would help, or if there's something in my approach that you'd expect the library to accomplish better in another way.