-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from inyutin-maxim/master
Implement Moq.Automock support
- Loading branch information
Showing
69 changed files
with
1,974 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...qComplete/Abc.MoqComplete.Tests/CodeAnalysis/AutoMockerSuspiciousCallbackAnalyzerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using JetBrains.ReSharper.FeaturesTestFramework.Daemon; | ||
using JetBrains.ReSharper.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Abc.MoqComplete.Tests.CodeAnalysis | ||
{ | ||
[TestNetCore21("Moq.AutoMock/1.2.0.120")] | ||
public class AutoMockerSuspiciousCallbackAnalyzerTests : CSharpHighlightingTestBase | ||
{ | ||
protected override string RelativeTestDataPath => "AutoMockerSuspiciousCallback"; | ||
|
||
[TestCase("typeMismatch_return_before")] | ||
[TestCase("typeCountMismatch_return_before")] | ||
[TestCase("typeMismatch_return_after")] | ||
[TestCase("typeCountMismatch_return_after")] | ||
[TestCase("typeMismatch_generic")] | ||
public void should_detect_suspicious_callback(string testSrc) => DoOneTest(testSrc); | ||
|
||
[TestCase("no_types")] | ||
[TestCase("generic_types")] | ||
[TestCase("implementation_types")] | ||
public void should_not_detect_suspicious_callback(string testSrc) => DoOneTest(testSrc); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Abc.MoqComplete/Abc.MoqComplete.Tests/Completion/AutoMockerCallbackMethodProviderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using JetBrains.ReSharper.FeaturesTestFramework.Completion; | ||
using JetBrains.ReSharper.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Abc.MoqComplete.Tests.Completion | ||
{ | ||
[TestNetCore21("Moq.AutoMock/1.2.0.120")] | ||
public class AutoMockerCallbackMethodProviderTests: CodeCompletionTestBase | ||
{ | ||
protected override CodeCompletionTestType TestType => CodeCompletionTestType.Action; | ||
protected override string RelativeTestDataPath => "AutoMockerCallbackCompletion"; | ||
|
||
[TestCase("callbackCompletion")] | ||
[TestCase("callbackCompletion_afterReturn")] | ||
[TestCase("callbackCompletion_generic")] | ||
public void should_fill_with_callback(string testSrc) => DoOneTest(testSrc); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Abc.MoqComplete/Abc.MoqComplete.Tests/Completion/AutoMockerItIsAnyProviderActionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using JetBrains.ReSharper.FeaturesTestFramework.Completion; | ||
using JetBrains.ReSharper.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Abc.MoqComplete.Tests.Completion | ||
{ | ||
[TestNetCore21("Moq.AutoMock/1.2.0.120")] | ||
public class AutoMockerItIsAnyProviderActionTests : CodeCompletionTestBase | ||
{ | ||
protected override CodeCompletionTestType TestType => CodeCompletionTestType.Action; | ||
|
||
protected override string RelativeTestDataPath => "AutoMockerItIsAnyCompletion"; | ||
|
||
[TestCase("itIsAnyCompletionFull")] | ||
[TestCase("itIsAnyCompletionParam")] | ||
[TestCase("itIsAnyCompletionGeneric")] | ||
[TestCase("itIsAnyVerifyCompletionFull")] | ||
public void should_fill_with_it_isAny(string testSrc) | ||
{ | ||
DoOneTest(testSrc); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Abc.MoqComplete/Abc.MoqComplete.Tests/Completion/AutoMockerItIsAnyProviderListTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using JetBrains.ReSharper.FeaturesTestFramework.Completion; | ||
using JetBrains.ReSharper.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Abc.MoqComplete.Tests.Completion | ||
{ | ||
[TestNetCore21("Moq.AutoMock/1.2.0.120")] | ||
public class AutoMockerItIsAnyProviderListTests : CodeCompletionTestBase | ||
{ | ||
protected override CodeCompletionTestType TestType => CodeCompletionTestType.List; | ||
|
||
protected override string RelativeTestDataPath => "AutoMockerItIsAnyCompletion"; | ||
|
||
[TestCase("itIsAnyCompletionList")] | ||
public void should_fill_with_overloads(string src) | ||
{ | ||
DoOneTest(src); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Abc.MoqComplete/Abc.MoqComplete.Tests/Completion/AutoMockerReturnsMethodProviderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using JetBrains.ReSharper.FeaturesTestFramework.Completion; | ||
using JetBrains.ReSharper.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Abc.MoqComplete.Tests.Completion | ||
{ | ||
[TestNetCore21("Moq.AutoMock/1.2.0.120")] | ||
public class AutoMockerReturnsMethodProviderTests : CodeCompletionTestBase | ||
{ | ||
protected override CodeCompletionTestType TestType => CodeCompletionTestType.Action; | ||
|
||
protected override string RelativeTestDataPath => "AutoMockerReturnsCompletion"; | ||
|
||
[TestCase("returnsCompletion")] | ||
[TestCase("returnsCompletion_afterCallback")] | ||
[TestCase("returnsCompletion_generic")] | ||
public void should_fill_with_callback(string testSrc) | ||
{ | ||
DoOneTest(testSrc); | ||
} | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
Abc.MoqComplete/Abc.MoqComplete.Tests/Completion/CallbackMethodProviderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...MoqComplete/Abc.MoqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// ${COMPLETE_ITEM:Callback<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>())) | ||
.c{caret} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...mplete/Abc.MoqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion.cs.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// ${COMPLETE_ITEM:Callback<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>())) | ||
.Callback<int,string,bool>((i,toto,ok) => {{caret}}) | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...Abc.MoqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion_afterReturn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ${COMPLETE_ITEM:Callback<int,string,bool>((i,toto,ok) => {\})} | ||
using Moq; | ||
using Moq.AutoMock; | ||
using NUnit.Framework; | ||
|
||
namespace ConsoleApp1.Tests | ||
{ | ||
public interface ITestInterface | ||
{ | ||
int 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(0) | ||
.c{caret} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...oqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion_afterReturn.cs.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ${COMPLETE_ITEM:Callback<int,string,bool>((i,toto,ok) => {\})} | ||
using Moq; | ||
using Moq.AutoMock; | ||
using NUnit.Framework; | ||
|
||
namespace ConsoleApp1.Tests | ||
{ | ||
public interface ITestInterface | ||
{ | ||
int 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(0) | ||
.Callback<int,string,bool>((i,toto,ok) => {{caret}}) | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ete/Abc.MoqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion_generic.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// ${COMPLETE_ITEM:Callback<ITest2,double,string>((test,test2,test3) => {\})} | ||
using NUnit.Framework; | ||
using Moq; | ||
using Moq.AutoMock; | ||
|
||
namespace ConsoleApp1.Tests | ||
{ | ||
public interface ITest<T, U> | ||
{ | ||
int Coco(ITest2 test, T test2, U test3); | ||
|
||
} | ||
public interface ITest2 : ITest<double, string> | ||
{ | ||
|
||
} | ||
|
||
[TestFixture] | ||
public class TestClass | ||
{ | ||
|
||
[Test] | ||
public void METHOD() | ||
{ | ||
var _mocker = new AutoMocker(); | ||
_mocker.Setup<ITest2>(x=>x.Coco(It.IsAny<ITest2>(), It.IsAny<double>(), It.IsAny<string>())) | ||
.{caret} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...bc.MoqComplete.Tests/data/AutoMockerCallbackCompletion/callbackCompletion_generic.cs.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// ${COMPLETE_ITEM:Callback<ITest2,double,string>((test,test2,test3) => {\})} | ||
using NUnit.Framework; | ||
using Moq; | ||
using Moq.AutoMock; | ||
|
||
namespace ConsoleApp1.Tests | ||
{ | ||
public interface ITest<T, U> | ||
{ | ||
int Coco(ITest2 test, T test2, U test3); | ||
|
||
} | ||
public interface ITest2 : ITest<double, string> | ||
{ | ||
|
||
} | ||
|
||
[TestFixture] | ||
public class TestClass | ||
{ | ||
|
||
[Test] | ||
public void METHOD() | ||
{ | ||
var _mocker = new AutoMocker(); | ||
_mocker.Setup<ITest2>(x=>x.Coco(It.IsAny<ITest2>(), It.IsAny<double>(), It.IsAny<string>())) | ||
.Callback<ITest2,double,string>((test,test2,test3) => {{caret}}) | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...qComplete/Abc.MoqComplete.Tests/data/AutoMockerItIsAnyCompletion/itIsAnyCompletionFull.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ${COMPLETE_ITEM:It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()} | ||
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{caret})) | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...lete/Abc.MoqComplete.Tests/data/AutoMockerItIsAnyCompletion/itIsAnyCompletionFull.cs.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ${COMPLETE_ITEM:It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()} | ||
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>())){caret} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...mplete/Abc.MoqComplete.Tests/data/AutoMockerItIsAnyCompletion/itIsAnyCompletionGeneric.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ${COMPLETE_ITEM:It.IsAny<ITest2>(), It.IsAny<double>(), It.IsAny<string>()} | ||
using NUnit.Framework; | ||
using System; | ||
using Moq; | ||
using Moq.AutoMock; | ||
|
||
namespace ConsoleApp1.Tests | ||
{ | ||
public class Test1 | ||
{ | ||
public interface ITest<T> | ||
{ | ||
void Coco(ITest2 test, T test2, string test3); | ||
|
||
} | ||
public interface ITest2 : ITest<double> | ||
{ | ||
|
||
} | ||
} | ||
|
||
[TestFixture] | ||
public class TestClass | ||
{ | ||
|
||
[Test] | ||
public void METHOD() | ||
{ | ||
var _mocker = new AutoMocker(); | ||
_mocker.Setup<Test1.ITest2>(x=>x.Coco(It{caret})); | ||
} | ||
} | ||
} |
Oops, something went wrong.