Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic error in unit test MatchesIsNotInEnumerable()? #1483

Open
praeceptum opened this issue May 21, 2024 · 0 comments
Open

Semantic error in unit test MatchesIsNotInEnumerable()? #1483

praeceptum opened this issue May 21, 2024 · 0 comments

Comments

@praeceptum
Copy link

praeceptum commented May 21, 2024

Regarding the class Moq.Tests.MatchersFixture, given that the setups in the unit test method MatchesIsInVariadicParameters() are:

mock.Setup(x => x.Echo(It.IsIn(1, 2, 3, 4, 5))).Returns(1);
mock.Setup(x => x.Echo(It.IsIn(6, 7, 8, 9, 10))).Returns(2);

then the ranges in MatchesIsNotInEnumerable():

mock.Setup(x => x.Echo(It.IsNotIn(Enumerable.Range(1, 5)))).Returns(1);
mock.Setup(x => x.Echo(It.IsNotIn(Enumerable.Range(6, 10)))).Returns(2);

were probably meant to be:

mock.Setup(x => x.Echo(It.IsNotIn(Enumerable.Range(1, 5)))).Returns(1);
mock.Setup(x => x.Echo(It.IsNotIn(Enumerable.Range(6, 5)))).Returns(2);

since the signature is Range(int start, int count), not Range(int start, int end).
 
 
The same is probably true for MatchesIsInEnumerable() given the ranges in MatchesRanges(), except that the latter is using an exclusive range for the second sequence.

Back this issue
Back this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants