From 02a8426e77a20cafbff8c5b7ffd472bc48fb4576 Mon Sep 17 00:00:00 2001 From: Richard Murillo Date: Mon, 26 Aug 2024 11:28:31 -0700 Subject: [PATCH] Add test case for #172 --- .../CallbackSignatureShouldMatchMockedMethodCodeFixTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Moq.Analyzers.Test/CallbackSignatureShouldMatchMockedMethodCodeFixTests.cs b/tests/Moq.Analyzers.Test/CallbackSignatureShouldMatchMockedMethodCodeFixTests.cs index 60a3e9d6..18370a91 100644 --- a/tests/Moq.Analyzers.Test/CallbackSignatureShouldMatchMockedMethodCodeFixTests.cs +++ b/tests/Moq.Analyzers.Test/CallbackSignatureShouldMatchMockedMethodCodeFixTests.cs @@ -73,6 +73,10 @@ public static IEnumerable TestData() """new Mock().Setup(x => x.Do(It.IsAny>())).Returns(0).Callback((List l) => { });""", """new Mock().Setup(x => x.Do(It.IsAny>())).Returns(0).Callback((List l) => { });""", ], + [ // Repro for https://github.com/rjmurillo/moq.analyzers/issues/172 + """new Mock().Setup(m => m.DoSomething(It.IsAny())).Returns((object? bar) => true);""", + """new Mock().Setup(m => m.DoSomething(It.IsAny())).Returns((object? bar) => true);""", + ], }.WithNamespaces().WithMoqReferenceAssemblyGroups(); } @@ -91,6 +95,8 @@ internal interface IFoo int Do(int i, string s, DateTime dt); int Do(List l); + + bool DoSomething(object? bar); } internal class UnitTest