Skip to content
Merged
36 changes: 18 additions & 18 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,38 @@
<FluentAssertionsVersion>6.11.0</FluentAssertionsVersion>
<MoqVersion>4.16.1</MoqVersion>
<!-- For coverage use our own package on latest stable -->
<MicrosoftCodeCoverageVersion>17.4.1</MicrosoftCodeCoverageVersion>
<MicrosoftCodeCoverageVersion>17.9.0</MicrosoftCodeCoverageVersion>
<!-- These versions are used for running unit tests, and running acceptance tests. They are also used as the default version for projects
in TestAssets.sln to allow running and debugging tests in that solution directly in VS without having to run them via AcceptanceTests. -->
<MSTestTestFrameworkVersion>2.3.0-preview-20220711-02</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>2.3.0-preview-20220711-02</MSTestTestAdapterVersion>
<MSTestTestFrameworkVersion>3.3.1</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>3.3.1</MSTestTestAdapterVersion>
<MSTestAssertExtensionVersion>1.0.3-preview</MSTestAssertExtensionVersion>
<XUnitFrameworkVersion>2.3.1</XUnitFrameworkVersion>
<XUnitAdapterVersion>2.3.1</XUnitAdapterVersion>
<XUnitConsoleRunnerVersion>2.3.1</XUnitConsoleRunnerVersion>
<NUnit3FrameworkVersion>3.10.1</NUnit3FrameworkVersion>
<NUnit3AdapterVersion>3.11.0</NUnit3AdapterVersion>
<NUnitConsoleRunnerVersion>3.8.0</NUnitConsoleRunnerVersion>
<XUnitFrameworkVersion>2.4.2</XUnitFrameworkVersion>
<XUnitAdapterVersion>2.4.5</XUnitAdapterVersion>
<XUnitConsoleRunnerVersion>2.4.2</XUnitConsoleRunnerVersion>
<NUnit3FrameworkVersion>3.14.0</NUnit3FrameworkVersion>
<NUnit3AdapterVersion>3.17.0</NUnit3AdapterVersion>
<NUnitConsoleRunnerVersion>3.16.3</NUnitConsoleRunnerVersion>
<!--
Versions that are used when building projects from TestAssets.sln for compatibility tests. See Invoke-TestAssetsBuild in scripts/build.ps1.
Exact versions are used to avoid Nuget substituting them by closest match, if we make a typo.
These versions need to be "statically" readable because we read this file as xml in our build and tests.
-->
<!-- <MSTestFrameworkLatestVersion></MSTestFrameworkLatestVersion> is not here, because we don't build MSTest locally, so we don't have access to the latest version. -->
<MSTestFrameworkLatestPreviewVersion>[2.3.0-preview-20220613-02]</MSTestFrameworkLatestPreviewVersion>
<MSTestFrameworkLatestStableVersion>[2.2.10]</MSTestFrameworkLatestStableVersion>
<MSTestFrameworkRecentStableVersion>[2.2.9]</MSTestFrameworkRecentStableVersion>
<MSTestFrameworkMostDownloadedVersion>[2.1.0]</MSTestFrameworkMostDownloadedVersion>
<MSTestFrameworkPreviousStableVersion>[2.1.0]</MSTestFrameworkPreviousStableVersion>
<MSTestFrameworkLatestPreviewVersion>[3.3.1]</MSTestFrameworkLatestPreviewVersion>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs to be some 3.4.0 preview version, right?

<MSTestFrameworkLatestStableVersion>[3.3.1]</MSTestFrameworkLatestStableVersion>
<MSTestFrameworkRecentStableVersion>[3.2.2]</MSTestFrameworkRecentStableVersion>
<MSTestFrameworkMostDownloadedVersion>[2.2.10]</MSTestFrameworkMostDownloadedVersion>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be correct semantically this should be 1.3.2 according to nuget.org ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. 🙂 I was also looking at this version. I chose 2.2.10 because it has more downloads over shorter period of time.

<MSTestFrameworkPreviousStableVersion>[2.2.10]</MSTestFrameworkPreviousStableVersion>
<MSTestFrameworkLegacyStableVersion>[1.4.0]</MSTestFrameworkLegacyStableVersion>
<!-- Versions that are used to restore previous versions of console, translation layer, and test.sdk for compatibility tests.
See Invoke-TestAssetsBuild in scripts/build.ps1. Exact versions are used to avoid Nuget substituting them by closest match, if we make a typo.
These versions need to be "statically" readable because we read this file as xml in our build and tests. -->
<!-- <VSTestConsoleLatestVersion></VSTestConsoleLatestVersion> is not here, NETTestSdkVersion is used instead, because that is the version of the locally built latest package. -->
<VSTestConsoleLatestPreviewVersion>[17.2.0-preview-20220401-08]</VSTestConsoleLatestPreviewVersion>
<VSTestConsoleLatestStableVersion>[17.2.0]</VSTestConsoleLatestStableVersion>
<VSTestConsoleRecentStableVersion>[17.1.0]</VSTestConsoleRecentStableVersion>
<VSTestConsoleMostDownloadedVersion>[16.6.1]</VSTestConsoleMostDownloadedVersion>
<VSTestConsoleLatestPreviewVersion>[17.10.0-release-24177-07]</VSTestConsoleLatestPreviewVersion>
<VSTestConsoleLatestStableVersion>[17.9.0]</VSTestConsoleLatestStableVersion>
<VSTestConsoleRecentStableVersion>[17.8.0]</VSTestConsoleRecentStableVersion>
<VSTestConsoleMostDownloadedVersion>[17.6.2]</VSTestConsoleMostDownloadedVersion>
<VSTestConsolePreviousStableVersion>[16.11.0]</VSTestConsolePreviousStableVersion>
<VSTestConsoleLegacyStableVersion>[15.9.2]</VSTestConsoleLegacyStableVersion>
<ILAsmPackageVersion>5.0.0</ILAsmPackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
return dataRows;
}

public string GetDisplayName(MethodInfo methodInfo, object[] data)
public string GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data));
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty<string>()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
return dataRows;
}

public string GetDisplayName(MethodInfo methodInfo, object[] data)
public string GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data));
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty<string>()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
return dataRows;
}

public string GetDisplayName(MethodInfo methodInfo, object[] data)
public string GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data));
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty<string>()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)
return dataRows;
}

public string GetDisplayName(MethodInfo methodInfo, object[] data)
public string GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data));
return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty<string>()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ IEnumerable<object[]> ITestDataSource.GetData(MethodInfo methodInfo)
return _data;
}

string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data)
string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return GetDisplayName(methodInfo, (T1)data[0]);
return GetDisplayName(methodInfo, (T1)data![0]!);
}
}

Expand Down Expand Up @@ -63,9 +63,9 @@ IEnumerable<object[]> ITestDataSource.GetData(MethodInfo methodInfo)
return _data;
}

string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data)
string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1]);
return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!);
}
}

Expand Down Expand Up @@ -95,9 +95,9 @@ IEnumerable<object[]> ITestDataSource.GetData(MethodInfo methodInfo)
return _data;
}

string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data)
string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1], (T3)data[2]);
return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!, (T3)data![2]!);
}
}

Expand Down Expand Up @@ -128,8 +128,8 @@ IEnumerable<object[]> ITestDataSource.GetData(MethodInfo methodInfo)
return _data;
}

string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data)
string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data)
{
return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1], (T3)data[2], (T4)data[3]);
return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!, (T3)data![2]!, (T4)data![3]!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
<PackageReference Include="Microsoft.TestPlatform.TestAsset.NativeCPP" Version="2.0.0" />
<PackageReference Include="Microsoft.TestPlatform.QTools.Assets" Version="2.0.0" />
<PackageReference Include="Procdump" Version="0.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class TelemetryPerfTestBase : PerformanceTestBase
public TelemetryPerfTestBase()
{
var telemetryConfiguration = TelemetryConfiguration.CreateDefault();
#pragma warning disable CS0618 // Type or member is obsolete
telemetryConfiguration.InstrumentationKey = TelemetryInstrumentationKey;
#pragma warning restore CS0618 // Type or member is obsolete

_client = new TelemetryClient(telemetryConfiguration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,18 @@ public async Task DataCollectorAttachmentProcessorAppDomain_ShouldReturnCorrectA
Assert.IsTrue(dcap.LoadSucceded);

var attachmentsResult = await dcap.ProcessAttachmentSetsAsync(doc.DocumentElement, attachments, new Progress<int>(), _loggerMock.Object, CancellationToken.None);
var firstAttachmentSet = attachmentsResult.First();

// assert
// We return same instance but we're marshaling so we expected different pointers
Assert.AreNotSame(attachmentSet, attachmentsResult);
Assert.AreNotSame(attachmentSet, firstAttachmentSet);

Assert.AreEqual(attachmentSet.DisplayName, attachmentsResult.First().DisplayName);
Assert.AreEqual(attachmentSet.Uri, attachmentsResult.First().Uri);
Assert.AreEqual(attachmentSet.DisplayName, firstAttachmentSet.DisplayName);
Assert.AreEqual(attachmentSet.Uri, firstAttachmentSet.Uri);
Assert.AreEqual(attachmentSet.Attachments.Count, attachmentsResult.Count);
Assert.AreEqual(attachmentSet.Attachments[0].Description, attachmentsResult.First().Attachments[0].Description);
Assert.AreEqual(attachmentSet.Attachments[0].Uri, attachmentsResult.First().Attachments[0].Uri);
Assert.AreEqual(attachmentSet.Attachments[0].Uri, attachmentsResult.First().Attachments[0].Uri);
Assert.AreEqual(attachmentSet.Attachments[0].Description, firstAttachmentSet.Attachments[0].Description);
Assert.AreEqual(attachmentSet.Attachments[0].Uri, firstAttachmentSet.Attachments[0].Uri);
Assert.AreEqual(attachmentSet.Attachments[0].Uri, firstAttachmentSet.Attachments[0].Uri);
}

[TestMethod]
Expand Down
14 changes: 12 additions & 2 deletions test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class IntegrationTestBase

protected readonly IntegrationTestEnvironment _testEnvironment;

private readonly string _testAdapterRelativePath = @"mstest.testadapter\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar);
private readonly string _msTestPre3_0AdapterRelativePath = @"mstest.testadapter\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar);
private readonly string _msTestAdapterRelativePath = @"mstest.testadapter\{0}\build\{1}".Replace('\\', Path.DirectorySeparatorChar);
private readonly string _nUnitTestAdapterRelativePath = @"nunit3testadapter\{0}\build".Replace('\\', Path.DirectorySeparatorChar);
private readonly string _xUnitTestAdapterRelativePath = @"xunit.runner.visualstudio\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar);

Expand Down Expand Up @@ -594,7 +595,16 @@ protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFr

if (testFramework == UnitTestFramework.MSTest)
{
adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _testAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["MSTestTestAdapterVersion"]);
var version = IntegrationTestEnvironment.DependencyVersions["MSTestTestAdapterVersion"];
if (version.StartsWith("3"))
{
var tfm = _testEnvironment.TargetFramework.StartsWith("net4") ? "net462" : _testEnvironment.TargetFramework;
adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _msTestAdapterRelativePath, version, tfm);
}
else
{
adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _msTestPre3_0AdapterRelativePath, version);
}
}
else if (testFramework == UnitTestFramework.NUnit)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CodeCoverageDataAttachmentsHandlerTests

public TestContext? TestContext { get; set; }

internal string TestFilesDirectory => Path.Combine(TestContext!.DeploymentDirectory, "TestFiles");
internal string TestFilesDirectory => Path.Combine(TestContext!.DeploymentDirectory!, "TestFiles");

public CodeCoverageDataAttachmentsHandlerTests()
{
Expand All @@ -50,19 +50,17 @@ public CodeCoverageDataAttachmentsHandlerTests()
#endif
}

#if NETFRAMEWORK
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
// Copying test files to correct place,
var assemblyPath = AppDomain.CurrentDomain.BaseDirectory;
var testFilesDirectory = Path.Combine(context.DeploymentDirectory, "TestFiles");
var testFilesDirectory = Path.Combine(context.DeploymentDirectory!, "TestFiles");
Directory.CreateDirectory(testFilesDirectory);
var files = Directory.GetFiles(Path.Combine(assemblyPath, "TestFiles"));
foreach (var file in files)
File.Copy(file, Path.Combine(testFilesDirectory, Path.GetFileName(file)));
}
#endif

[TestMethod]
public async Task HandleDataCollectionAttachmentSetsShouldReturnEmptySetWhenNoAttachmentsOrAttachmentsAreNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkMinimum)' ">
<PackageReference Include="System.Memory" Version="4.5.3"/>
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)"/>
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
Expand Down
2 changes: 1 addition & 1 deletion test/TestAssets/TerminalLoggerTestProject/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void PassingTest()
public void FailingTest()
{
// test characters taken from https://pages.ucsd.edu/~dkjordan/chin/unitestuni.html
Assert.AreEqual("ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀", 3);
Assert.AreEqual("ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀", "not the same");
}

/// <summary>
Expand Down