Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions GoogleTestAdapter/Core.Tests/GoogleTestDiscovererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void GetTestsFromExecutable_DoNotParseSymbolInformation_DiaIsNotInvoked()
testCase.LineNumber.Should().Be(0);
testCase.Source.Should().Be(TestResources.Tests_DebugX86);
testCase.DisplayName.Should().NotBeNullOrEmpty();
testCase.FullyQualifiedName.Should().NotBeNullOrEmpty();
testCase.FullyQualifiedNameWithoutNamespace.Should().NotBeNullOrEmpty();
}
}

Expand All @@ -309,8 +309,8 @@ public void DiscoverTests_TestDiscoveryParam_TestsFoundWithAdditionalDiscoveryPa
discoverer.DiscoverTests(TestResources.TestDiscoveryParamExe.Yield(), MockFrameworkReporter.Object);

testCases.Count.Should().Be(2);
testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails");
testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses");
testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails");
testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses");
}

[TestMethod]
Expand All @@ -323,8 +323,8 @@ public void GetTestsFromExecubable_TestDiscoveryParam_TestsFoundWithAdditionalDi
IList<TestCase> testCases = discoverer.GetTestsFromExecutable(TestResources.TestDiscoveryParamExe);

testCases.Count.Should().Be(2);
testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails");
testCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses");
testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails");
testCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses");
}

[TestMethod]
Expand All @@ -338,7 +338,7 @@ public void GetTestsFromExecutable_LoadTests_AllTestsAreFound()
for (int i = 0; i < 5000; i++)
{
string fullyQualifiedName = $"LoadTests.Test/{i}";
bool contains = testCases.Any(tc => tc.FullyQualifiedName == fullyQualifiedName);
bool contains = testCases.Any(tc => tc.FullyQualifiedNameWithoutNamespace == fullyQualifiedName);
contains.Should().BeTrue($" Test not found: {fullyQualifiedName}");
}
}
Expand Down Expand Up @@ -374,12 +374,12 @@ private void FindTests(string location)

testCases.Count.Should().Be(TestResources.NrOfTests);

TestCase testCase = testCases.Single(tc => tc.FullyQualifiedName == "TheFixture.AddFails");
TestCase testCase = testCases.Single(tc => tc.FullyQualifiedNameWithoutNamespace == "TheFixture.AddFails");
testCase.DisplayName.Should().Be("TheFixture.AddFails");
testCase.CodeFilePath.Should().EndWith(@"sampletests\tests\fixturetests.cpp");
testCase.LineNumber.Should().Be(11);

testCase = testCases.Single(tc => tc.FullyQualifiedName == "Arr/TypeParameterizedTests/1.CanDefeatMath");
testCase = testCases.Single(tc => tc.FullyQualifiedNameWithoutNamespace == "Arr/TypeParameterizedTests/1.CanDefeatMath");
testCase.DisplayName.Should().Be("Arr/TypeParameterizedTests/1.CanDefeatMath<MyStrangeArray>");
testCase.CodeFilePath.Should().EndWith(@"sampletests\tests\typeparameterizedtests.cpp");
testCase.LineNumber.Should().Be(53);
Expand Down Expand Up @@ -416,7 +416,7 @@ private void AssertFindsTest(string fullyQualifiedName, Regex displayNameRegex)
var discoverer = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options);
IList<TestCase> tests = discoverer.GetTestsFromExecutable(TestResources.Tests_DebugX86);

TestCase testCase = tests.Single(t => t.FullyQualifiedName == fullyQualifiedName);
TestCase testCase = tests.Single(t => t.FullyQualifiedNameWithoutNamespace == fullyQualifiedName);
testCase.DisplayName.Should().MatchRegex(displayNameRegex.ToString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void SplitTestcases_SimpleCase_TestsAreDistributedCorrectly()

result.Count.Should().Be(2);
result[0].Count.Should().Be(1);
result[0][0].FullyQualifiedName.Should().Be("LongTest");
result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest");
result[1].Count.Should().Be(3);
}

Expand All @@ -49,7 +49,7 @@ public void SplitTestcases_SimpleCaseWithThreeThreads_TestsAreDistributedCorrect

result.Count.Should().Be(3);
result[0].Count.Should().Be(1);
result[0][0].FullyQualifiedName.Should().Be("LongTest");
result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest");
result[1].Count.Should().Be(2);
result[2].Count.Should().Be(1);
}
Expand All @@ -69,7 +69,7 @@ public void SplitTestcases_AsymmetricCase_TestsAreDistributedCorrectly()

result.Count.Should().Be(2);
result[0].Count.Should().Be(1);
result[0][0].FullyQualifiedName.Should().Be("LongTest");
result[0][0].FullyQualifiedNameWithoutNamespace.Should().Be("LongTest");
result[1].Count.Should().Be(1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void CreateTestCases_AdditionalTestDiscoveryParam_TestDiscoveryUsesAdditi
var returnedTestCases = factory.CreateTestCases(testCase => reportedTestCases.Add(testCase));

reportedTestCases.Count.Should().Be(2);
reportedTestCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestFails");
reportedTestCases.Should().Contain(t => t.FullyQualifiedName == "TestDiscovery.TestPasses");
reportedTestCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestFails");
reportedTestCases.Should().Contain(t => t.FullyQualifiedNameWithoutNamespace == "TestDiscovery.TestPasses");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly()

results.Count.Should().Be(3);

results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails");
XmlTestResultParserTests.AssertTestResultIsFailure(results[0]);
results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText);
results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3));
results[0].ErrorStackTrace.Should()
.Contain(
@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp");

results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses");
results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses");
XmlTestResultParserTests.AssertTestResultIsPassed(results[1]);
results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration);

results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash");
results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash");
XmlTestResultParserTests.AssertTestResultIsFailure(results[2]);
results[2].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText);
results[2].Duration.Should().Be(TimeSpan.FromMilliseconds(9));
Expand All @@ -169,13 +169,13 @@ public void GetTestResults_OutputWithImmediateCrash_CorrectResultHasCrashText()

results.Count.Should().Be(2);

results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails");
XmlTestResultParserTests.AssertTestResultIsFailure(results[0]);
results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText);
results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3));
results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp");

results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses");
results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses");
XmlTestResultParserTests.AssertTestResultIsFailure(results[1]);
results[1].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText);
results[1].ErrorMessage.Should().NotContain("Test output:");
Expand All @@ -190,17 +190,17 @@ public void GetTestResults_OutputWithCrashAfterErrorMessage_CorrectResultHasCras

results.Count.Should().Be(3);

results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails");
XmlTestResultParserTests.AssertTestResultIsFailure(results[0]);
results[0].ErrorMessage.Should().NotContain(StandardOutputTestResultParser.CrashText);
results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(3));
results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp");

results[1].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses");
results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses");
XmlTestResultParserTests.AssertTestResultIsPassed(results[1]);
results[1].Duration.Should().Be(StandardOutputTestResultParser.ShortTestDuration);

results[2].TestCase.FullyQualifiedName.Should().Be("TestMath.Crash");
results[2].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.Crash");
XmlTestResultParserTests.AssertTestResultIsFailure(results[2]);
results[2].ErrorMessage.Should().Contain(StandardOutputTestResultParser.CrashText);
results[2].ErrorMessage.Should().Contain("Test output:");
Expand All @@ -215,7 +215,7 @@ public void GetTestResults_OutputWithInvalidDurationUnit_DefaultDurationIsUsedAn
List<TestResult> results = ComputeTestResults(WrongDurationUnit);

results.Count.Should().Be(1);
results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails");
results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(1));
results[0].ErrorStackTrace.Should().Contain(@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp");

Expand All @@ -234,7 +234,7 @@ public void GetTestResults_OutputWithThousandsSeparatorInDuration_ParsedCorrectl
List<TestResult> results = ComputeTestResults(ThousandsSeparatorInDuration);

results.Count.Should().Be(1);
results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddFails");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddFails");
results[0].Duration.Should().Be(TimeSpan.FromMilliseconds(4656));
}
finally
Expand All @@ -250,7 +250,7 @@ public void GetTestResults_OutputWithConsoleOutput_ConsoleOutputIsIgnored()
List<TestResult> results = ComputeTestResults(PassingTestProducesConsoleOutput);

results.Count.Should().Be(1);
results[0].TestCase.FullyQualifiedName.Should().Be("TestMath.AddPasses");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("TestMath.AddPasses");
XmlTestResultParserTests.AssertTestResultIsPassed(results[0]);
}

Expand All @@ -270,9 +270,9 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound()
.GetTestResults();

results.Count.Should().Be(2);
results[0].TestCase.FullyQualifiedName.Should().Be("Test.AB");
results[0].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.AB");
XmlTestResultParserTests.AssertTestResultIsPassed(results[0]);
results[1].TestCase.FullyQualifiedName.Should().Be("Test.A");
results[1].TestCase.FullyQualifiedNameWithoutNamespace.Should().Be("Test.A");
XmlTestResultParserTests.AssertTestResultIsPassed(results[1]);
}

Expand Down
Loading