-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source locations for tests contained in namespaces are found again
- Loading branch information
1 parent
9970eaf
commit a683682
Showing
20 changed files
with
245 additions
and
20 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
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
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
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
85 changes: 85 additions & 0 deletions
85
GoogleTestAdapter/Core.Tests/TestCases/TestCaseResolverTests.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,85 @@ | ||
using System.Linq; | ||
using FluentAssertions; | ||
using GoogleTestAdapter.DiaResolver; | ||
using GoogleTestAdapter.Helpers; | ||
using GoogleTestAdapter.Tests.Common; | ||
using GoogleTestAdapter.Tests.Common.Fakes; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using static GoogleTestAdapter.Tests.Common.TestMetadata.TestCategories; | ||
|
||
namespace GoogleTestAdapter.TestCases | ||
{ | ||
|
||
[TestClass] | ||
public class TestCaseResolverTests : TestsBase | ||
{ | ||
private FakeLogger _fakeLogger; | ||
|
||
[TestInitialize] | ||
public void Setup() | ||
{ | ||
_fakeLogger = new FakeLogger(() => true, false); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named", 9); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named_Named", 16); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named_Anon", 25); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon", 35); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon_Anon", 42); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon_Named", 51); | ||
} | ||
|
||
private void AssertCorrectTestLocationIsFound(string suite, uint line) | ||
{ | ||
var resolver = new TestCaseResolver(TestResources.Tests_ReleaseX64, "", "".Yield(), | ||
new DefaultDiaResolverFactory(), true, _fakeLogger); | ||
var signatureCreator = new MethodSignatureCreator(); | ||
var descriptor = new TestCaseDescriptor(suite, "Test", $"{suite}.Test", $"{suite}.Test", | ||
TestCaseDescriptor.TestTypes.Simple); | ||
var signatures = signatureCreator.GetTestMethodSignatures(descriptor); | ||
|
||
var testCaseLocation = resolver.FindTestCaseLocation(signatures.ToList()); | ||
|
||
_fakeLogger.Errors.Should().BeEmpty(); | ||
|
||
testCaseLocation.Should().NotBeNull(); | ||
testCaseLocation.Sourcefile.Should().EndWithEquivalent(@"sampletests\tests\namespacetests.cpp"); | ||
testCaseLocation.Line.Should().Be(line); | ||
} | ||
} | ||
|
||
} |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.