Skip to content

Commit

Permalink
Add additional repro cases for #172 (thanks @marcovr)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmurillo committed Aug 27, 2024
1 parent da6de24 commit dcd245d
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,26 @@ public static IEnumerable<object[]> TestData()
"""new Mock<IFoo>().Setup(x => x.Do(It.IsAny<List<string>>())).Returns(0).Callback((List<string> l) => { });""",
"""new Mock<IFoo>().Setup(x => x.Do(It.IsAny<List<string>>())).Returns(0).Callback((List<string> l) => { });""",
],
[ // Repro for https://github.com/rjmurillo/moq.analyzers/issues/172
[ // Repros for https://github.com/rjmurillo/moq.analyzers/issues/172
"""new Mock<IFoo>().Setup(m => m.Do(It.IsAny<object?>())).Returns((object? bar) => true);""",
"""new Mock<IFoo>().Setup(m => m.Do(It.IsAny<object?>())).Returns((object? bar) => true);""",
],
[
"""new Mock<IFoo>().Setup(m => m.Do(42)).Returns((long bar) => true);""",
"""new Mock<IFoo>().Setup(m => m.Do(42)).Returns((long bar) => true);""",
],
[
"""new Mock<IFoo>().Setup(m => m.Do((long)42)).Returns((long bar) => true);""",
"""new Mock<IFoo>().Setup(m => m.Do((long)42)).Returns((long bar) => true);""",
],
[
"""new Mock<IFoo>().Setup(m => m.Do((long)42)).Returns((long bar) => true);""",
"""new Mock<IFoo>().Setup(m => m.Do((long)42)).Returns((long bar) => true);""",
],
[ // This was also reported as part of 172, but is a different error
"""new Mock<IFoo>().Setup(m => m.Do(42)).Returns((int bar) => true);""",
"""new Mock<IFoo>().Setup(m => m.Do(42)).Returns((int bar) => true);""",
],
}.WithNamespaces().WithMoqReferenceAssemblyGroups();
}

Expand All @@ -105,6 +121,8 @@ internal interface IFoo
int Do(List<string> l);
bool Do(object? bar);
// bool Do(long bar);
}
internal class UnitTest
Expand Down

0 comments on commit dcd245d

Please sign in to comment.