You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
Hi, everyone.
I've implemented a service that sends sms to some devices by means of AWS SNS Service.
The service checks for each device if it exists in a whitelist table. If the device isn't found, the sms is sent to a fallback number.
So, I've a WhiteListUser class:
public class WhiteListUser
{
[Key]
public string Device { get; set; }
public string Username { get; set; }
public bool IsFallback { get; set; }
}
it seems that these two setups are not working, so devices are never found and all the devices are so replaced, also the third one that is in the whitelist:
UnitTests.Services.SNSServiceTest.Does_Replace_Only_Not_In_Whitelist_Numbers_With_Fallback_In_Dev_Env
Source: SNSServiceTest.cs line 34
Duration: 11 ms
Message:
Moq.MockException :
Expected invocation on the mock at least once, but was never performed: x => x.SendSmsAsync(It.Is<IList>(l => ((l.Count == 3 && l[0].Equals(WhiteListFixtures.FallbackUser.Device)) && l[1].Equals(WhiteListFixtures.FallbackUser.Device)) && l[2].Equals(WhiteListFixtures.WhiteListUser.Device)), "pippo", CancellationToken)
Stack Trace:
Mock.Verify(Mock mock, LambdaExpression expression, Times times, String failMessage) line 330
Mock1.Verify[TResult](Expression1 expression) line 810
SNSServiceTest.Does_Replace_Only_Not_In_Whitelist_Numbers_With_Fallback_In_Dev_Env() line 67
--- End of stack trace from previous location ---
I don't know what am I doing wrong, if the test or the implementation.
I was expecting: IAwsProvider.SendSmsAsync(["+39370XXXXXXX", "+39370XXXXXXX", "+39370YYYYYYY"], "pippo", CancellationToken)
Can any expert help me?
Thanks in advance
The text was updated successfully, but these errors were encountered:
@fsodano13, this issue tracker focuses on the development of Moq itself, not on fixing user code. Your query might meet a larger audience on sites such as Stack Overflow, or in Moq's Discord chat.
HI @stakx I'm not asking for debugging my code. I do not understand why
the call await _repository.Find(u => u.Device == device) doesn't return expected feature.
I want to understand if i'm not using well the library or there is some issue in that.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, everyone.
I've implemented a service that sends sms to some devices by means of AWS SNS Service.
The service checks for each device if it exists in a whitelist table. If the device isn't found, the sms is sent to a fallback number.
So, I've a WhiteListUser class:
An application context :
and the service:
SendSms event is a record with a message and a list of devices:
When I try to run this test, it fails:
where Fixtures are:
public class WhiteListFixtures
{
}
it seems that these two setups are not working, so devices are never found and all the devices are so replaced, also the third one that is in the whitelist:
this is the error message:
UnitTests.Services.SNSServiceTest.Does_Replace_Only_Not_In_Whitelist_Numbers_With_Fallback_In_Dev_Env
Source: SNSServiceTest.cs line 34
Duration: 11 ms
Message:
Moq.MockException :
Expected invocation on the mock at least once, but was never performed: x => x.SendSmsAsync(It.Is<IList>(l => ((l.Count == 3 && l[0].Equals(WhiteListFixtures.FallbackUser.Device)) && l[1].Equals(WhiteListFixtures.FallbackUser.Device)) && l[2].Equals(WhiteListFixtures.WhiteListUser.Device)), "pippo", CancellationToken)
Performed invocations:
MockIAwsProvider:2 (x):
Stack Trace:
Mock.Verify(Mock mock, LambdaExpression expression, Times times, String failMessage) line 330
Mock
1.Verify[TResult](Expression
1 expression) line 810SNSServiceTest.Does_Replace_Only_Not_In_Whitelist_Numbers_With_Fallback_In_Dev_Env() line 67
--- End of stack trace from previous location ---
I don't know what am I doing wrong, if the test or the implementation.
I was expecting: IAwsProvider.SendSmsAsync(["+39370XXXXXXX", "+39370XXXXXXX", "+39370YYYYYYY"], "pippo", CancellationToken)
Can any expert help me?
Thanks in advance
The text was updated successfully, but these errors were encountered: