failed test due to unexpected exception
iriapb opened this issue · comments
Message:
Moq.VerifyLogUnexpectedException : Moq.ILogger found an unexpected exception.
Please open an issue at https://github.com/adrianiftode/Moq.ILogger/issues/new, provide the exception details and a sample code if possible.
Below will follow the unexpected exception details.
----> System.FormatException : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
System.FormatException : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Stack Trace:
VerifyLogExtensions.Verify[T](Mock1 loggerMock, Expression
1 expression, Nullable1 times, Func
1 timesFunc, String failMessage)
VerifyLogExtensions.VerifyLog[T](Mock1 loggerMock, Expression
1 expression)
SendKCITests.FailedToSendMessageToCommunicationManagement_SendReminderPriorDeletion_BadIdentityProvider() line 385
GenericAdapter1.GetResult() AsyncToSyncAdapter.Await(Func
1 invoke)
TestMethodCommand.RunTestMethod(TestExecutionContext context)
TestMethodCommand.Execute(TestExecutionContext context)
<>c__DisplayClass1_0.b__0()
BeforeAndAfterTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
--FormatException
<6 more frames...>
<>c__DisplayClass7_01.<Is>b__0(Object argument, Type parameterType) line 172 MatchFactory.Matches(Object argument, Type parameterType) line 251 IMatcher.Matches(Object argument, Type parameterType) line 78 InvocationShape.IsMatch(Invocation invocation) line 132 WhereArrayIterator
1.MoveNext()
Mock.GetMatchingInvocationCount(Mock mock, ImmutablePopOnlyStack1& parts, HashSet
1 visitedInnerMocks, List1 invocationsToBeMarkedAsVerified) line 467 Mock.GetMatchingInvocationCount(Mock mock, LambdaExpression expression, List
1& invocationsToBeMarkedAsVerified) line 439
Mock.Verify(Mock mock, LambdaExpression expression, Times times, String failMessage) line 323
Mock1.Verify(Expression
1 expression, String failMessage) line 764
VerifyLogExtensions.Verify[T](Mock1 loggerMock, Expression
1 expression, Nullable1 times, Func
1 timesFunc, String failMessage)
sample code:
_loggerMock.VerifyLog(logger => logger.LogError(EventCodes.Cids.AutoDelete.Errors.AZFUNC_SENDKCI_SENDMESSAGE_EXCEPTION_FUNCTIONALITYNOTAVAILABLE,
"Send email reminder of user login before deletion not available for brand: {staleCidsAccount.Brand}, objectId: {staleCidsAccount.ObjectId} and correlationId: {correlationId}. Response : {response.Reason}",
_staleCidsAccountReminderToSendBT.Brand,
_staleCidsAccountReminderToSendBT.ObjectId,
_staleCidsAccountReminderToSendBT.CorrelationId
));
Thanks for raising this issue. I have one question. Instead of
_loggerMock.VerifyLog(logger => logger.LogError(EventCodes.Cids.AutoDelete.Errors.AZFUNC_SENDKCI_SENDMESSAGE_EXCEPTION_FUNCTIONALITYNOTAVAILABLE,
"Send email reminder of user login before deletion not available for brand: {staleCidsAccount.Brand}, objectId: {staleCidsAccount.ObjectId} and correlationId: {correlationId}. Response : {response.Reason}",
_staleCidsAccountReminderToSendBT.Brand,
_staleCidsAccountReminderToSendBT.ObjectId,
_staleCidsAccountReminderToSendBT.CorrelationId
));
shouldn't be
_loggerMock.VerifyLog(logger => logger.LogError(EventCodes.Cids.AutoDelete.Errors.AZFUNC_SENDKCI_SENDMESSAGE_EXCEPTION_FUNCTIONALITYNOTAVAILABLE,
"Send email reminder of user login before deletion not available for brand: {staleCidsAccount.Brand}, objectId: {staleCidsAccount.ObjectId} and correlationId: {correlationId}. Response : {response.Reason}",
_staleCidsAccountReminderToSendBT.Brand,
_staleCidsAccountReminderToSendBT.ObjectId,
_staleCidsAccountReminderToSendBT.CorrelationId,
response.Reason
));
Isn't the response.Reason
part missing?
@iriapb closing this issue, as it is the expected bahaviour. You can reopen if there are more details.