Skip to content

Semantic error in unit test MatchesIsNotInEnumerable()? #1483

Open
@praeceptum

Description

@praeceptum

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions