Skip to content

Commit

Permalink
Avoid returns completion when mocked method returns void
Browse files Browse the repository at this point in the history
  • Loading branch information
lconstan committed Apr 8, 2020
1 parent e9d83fb commit 8f53868
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
// ${COMPLETE_ITEM:Returns<int,string,bool>((i,toto,ok) => )}
using Moq;
using Moq.AutoMock;
using NUnit.Framework;

namespace ConsoleApp1.Tests
{
public interface ITestInterface
{
void BuildSomething(int i, string toto, bool ok);
}

[TestFixture]
public class Test1
{
[Test]
public void METHOD()
{
var _mocker = new AutoMocker();
_mocker.Setup<ITestInterface>(x => x.BuildSomething(It.IsAny<int>(),It.IsAny<string>(), It.IsAny<bool>()))
.Returns<int,string,bool>((i,toto,ok) => {caret})
}
}
}
Raises{caret}
Original file line number Diff line number Diff line change
@@ -1,23 +1,2 @@
// ${COMPLETE_ITEM:Returns<int,string,bool>((i,toto,ok) => )}
using Moq;
using NUnit.Framework;

namespace ConsoleApp1.Tests
{
public interface ITestInterface
{
void BuildSomething(int i, string toto, bool ok);
}

[TestFixture]
public class Test1
{
[Test]
public void METHOD()
{
Mock<ITestInterface> temp = new Mock<ITestInterface>();
temp.Setup(x => x.BuildSomething(It.IsAny<int>(),It.IsAny<string>(), It.IsAny<bool>()))
.Returns<int,string,bool>((i,toto,ok) => {caret})
}
}
}
Raises{caret}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override bool AddLookupItems(CSharpCodeCompletionContext context, IIte

var mockedMethod = GetMockedMethodFromSetupMethod(solution, invocation);

if (mockedMethod == null || mockedMethod.Parameters.Count == 0)
if (mockedMethod == null || mockedMethod.Parameters.Count == 0 || mockedMethod.ReturnType.IsVoid())
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Abc.MoqComplete/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>1.3.0</Version>
<Version>1.3.1</Version>
</PropertyGroup>

</Project>

0 comments on commit 8f53868

Please sign in to comment.