From 63883b0d248d15e8e18965ad998b96eccb0be8ab Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Thu, 2 Nov 2023 10:33:52 +0100 Subject: [PATCH] Use mstestv3 as testing framework (#372) * Switch to using nuget MSTest for all test projects (even .NET framework) * update MSTest.* to 3.1.1 * Update Microsoft.NET.Test.Sdk to 17.7.2 * Fix search paths in CreateRiaClientFiles_For_Net_60 * Add workaround for #447 --- azure-pipelines.yml | 8 +- ...penRiaServices.Client.External.Test.csproj | 7 +- .../OpenRiaServices.Client.Test.csproj | 15 +--- .../OpenRiaServices.Client.Vb.Test.csproj | 15 +--- .../VbDomainClients/VbDomainClients.vbproj | 9 +-- ...RiaServices.Hosting.AspNetCore.Test.csproj | 6 +- .../OpenRiaServices.Hosting.Local.Test.csproj | 7 +- ...aServices.Hosting.Wcf.Endpoint.Test.csproj | 7 +- ...nRiaServices.Hosting.Wcf.OData.Test.csproj | 7 +- .../OpenRiaServices.Hosting.Wcf.Test.csproj | 7 +- ...uthentication.AspNetMembership.Test.csproj | 7 +- ...RiaServices.Server.UnitTesting.Test.csproj | 13 +--- .../Test/OpenRiaServices.Server.Test.csproj | 7 +- ...RiaServices.Tools.TextTemplate.Test.csproj | 12 +-- .../Test/CreateRiaClientFilesTaskTests.cs | 4 +- .../Test/NotificationMethodGeneratorTest.cs | 75 ++----------------- .../Test/OpenRiaServices.Tools.Test.csproj | 14 ++-- src/OpenRiaServices.Tools/Test/TestHelper.cs | 26 +++---- .../Test/Utilities/TestInitializer.cs | 6 +- .../OpenRiaServices.Common.Test.csproj | 12 ++- ...iaservices.EndToEnd.AspNetCore.Test.csproj | 12 +-- .../Data/InvokeOperationTests.cs | 4 +- .../Data/UpdateTests.cs | 3 +- .../OpenRiaservices.EndToEnd.Wcf.Test.csproj | 9 +-- ...ualStudio.DomainServices.Tools.Test.csproj | 8 +- 25 files changed, 90 insertions(+), 210 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dc4c2538f..574b746cd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -87,7 +87,7 @@ steps: platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' diagnosticsEnabled: false - timeoutInMinutes: 25 + timeoutInMinutes: 15 - task: VSTest@2 displayName: 'Run tests - net6' @@ -100,14 +100,14 @@ steps: runOnlyImpactedTests: false # Needed to hardcode path to test adapters for NET48 tests - pathtoCustomTestAdapters: '$(Build.SourcesDirectory)\src\OpenRiaServices.Server.UnitTesting\Test\bin\$(BuildConfiguration)\net6.0\' + # pathtoCustomTestAdapters: '$(Build.SourcesDirectory)\src\OpenRiaServices.Server.UnitTesting\Test\bin\$(BuildConfiguration)\net6.0\' runInParallel: true - runSettingsFile: 'src\test.runsettings' + # runSettingsFile: 'src\test.runsettings' codeCoverageEnabled: true platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' diagnosticsEnabled: false - timeoutInMinutes: 25 + timeoutInMinutes: 15 - task: SonarCloudAnalyze@1 displayName: 'Run Code Analysis' diff --git a/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj b/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj index d529975b4..b6267d278 100644 --- a/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj @@ -4,12 +4,11 @@ 1.0.0.0 - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj b/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj index 876acc3a1..d44557405 100644 --- a/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj @@ -13,18 +13,11 @@ - + + + - - - - - - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - + diff --git a/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj b/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj index be6d77e9b..82d0467f3 100644 --- a/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj @@ -8,18 +8,11 @@ - + + + - - - - - - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - + diff --git a/src/OpenRiaServices.Client/Test/VbDomainClients/VbDomainClients.vbproj b/src/OpenRiaServices.Client/Test/VbDomainClients/VbDomainClients.vbproj index f18885701..1644a9097 100644 --- a/src/OpenRiaServices.Client/Test/VbDomainClients/VbDomainClients.vbproj +++ b/src/OpenRiaServices.Client/Test/VbDomainClients/VbDomainClients.vbproj @@ -16,15 +16,7 @@ $(NoWarn);BC40000 - - - - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - @@ -46,6 +38,7 @@ + diff --git a/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj b/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj index f169b3353..d2979ba2a 100644 --- a/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj +++ b/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj b/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj index e69751f40..dec7f2bff 100644 --- a/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj +++ b/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj @@ -7,12 +7,11 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj b/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj index 92c62c55e..ef894ec4c 100644 --- a/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj +++ b/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj @@ -5,12 +5,11 @@ 1.0.0.0 - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Hosting.Wcf.OData/Test/OpenRiaServices.Hosting.Wcf.OData.Test.csproj b/src/OpenRiaServices.Hosting.Wcf.OData/Test/OpenRiaServices.Hosting.Wcf.OData.Test.csproj index e9e0d03cc..e17a223a4 100644 --- a/src/OpenRiaServices.Hosting.Wcf.OData/Test/OpenRiaServices.Hosting.Wcf.OData.Test.csproj +++ b/src/OpenRiaServices.Hosting.Wcf.OData/Test/OpenRiaServices.Hosting.Wcf.OData.Test.csproj @@ -14,12 +14,11 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj b/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj index 61d06aeda..47f1a942d 100644 --- a/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj +++ b/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj @@ -6,12 +6,11 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj b/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj index 1cbcd7671..d0935bcb5 100644 --- a/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj +++ b/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj @@ -10,12 +10,11 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj b/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj index 9650d78ed..1c1a9637a 100644 --- a/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj +++ b/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj @@ -6,16 +6,9 @@ - - - - - - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - + + + diff --git a/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj b/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj index b587166d9..2bd418f77 100644 --- a/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj +++ b/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj @@ -6,12 +6,11 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj b/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj index 74a9eb155..cbde4992e 100644 --- a/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj +++ b/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj @@ -44,22 +44,16 @@ - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - - - - - - \ No newline at end of file diff --git a/src/OpenRiaServices.Tools/Test/CreateRiaClientFilesTaskTests.cs b/src/OpenRiaServices.Tools/Test/CreateRiaClientFilesTaskTests.cs index 67cccbf08..e7195aa7b 100644 --- a/src/OpenRiaServices.Tools/Test/CreateRiaClientFilesTaskTests.cs +++ b/src/OpenRiaServices.Tools/Test/CreateRiaClientFilesTaskTests.cs @@ -289,7 +289,9 @@ public void CreateRiaClientFiles_Missing_Pdb_Warns() [TestMethod] public void CreateRiaClientFiles_For_Net_60() { - var rootPath = new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName; + TestHelper.GetProjectPaths("", out string projectPath, out _); + + var rootPath = new DirectoryInfo(projectPath).Parent.FullName; var serverProjectPath = Path.Combine(rootPath, "ServerClassLib\\ServerClassLib.csproj"); var clientProjectPath = Path.Combine(rootPath, "ClientClassLib\\ClientClassLib.csproj"); diff --git a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs index a3ae837fb..c03d4c5c5 100644 --- a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs +++ b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs @@ -9,15 +9,10 @@ namespace OpenRiaServices.Tools.Test { [TestClass()] + [DeploymentItem("NotificationMethodGeneratorTestCodeSnippets.xml")] + [DeploymentItem("NotificationMethodGeneratorTests.xml")] public class NotificationMethodGeneratorTest { - private TestContext context; - public TestContext TestContext - { - get { return this.context; } - set { this.context = value; } - } - private static XmlReader XmlReader; static IEnumerable GetTestCasesFromXml(string filename, string nodeName, string[] attributes) @@ -42,22 +37,8 @@ public static IEnumerable PartialMethodsSnippetBlockTestCases => GetTestCasesFromXml("NotificationMethodGeneratorTests.xml", "PartialMethodsSnippetBlockArgs", new[] { "comments", "baseMethodNames", "parameters" }); [ - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTests.xml"), - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTestCodeSnippets.xml"), TestMethod, -#if NETFRAMEWORK - DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\NotificationMethodGeneratorTests.xml", "PartialMethodsSnippetBlockArgs", DataAccessMethod.Sequential)] - public void PartialMethodsSnippetBlockTest() - { - string comments = this.TestContext.DataRow["comments"].ToString(); - string baseMethodNames = this.TestContext.DataRow["baseMethodNames"].ToString(); - string parameters = this.TestContext.DataRow["parameters"].ToString(); - - PartialMethodsSnippetBlockTest(comments, baseMethodNames, parameters); - } -#else DynamicData(nameof(PartialMethodsSnippetBlockTestCases))] -#endif public void PartialMethodsSnippetBlockTest(string comments, string baseMethodNames, string parameters) { string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); @@ -79,7 +60,7 @@ public void PartialMethodsSnippetBlockTest(bool isCSharp, string comments, strin // do verification ... if (XmlReader == null) { - XmlReader = XmlReader.Create(this.TestContext.TestDeploymentDir + "\\NotificationMethodGeneratorTestCodeSnippets.xml"); + XmlReader = XmlReader.Create("NotificationMethodGeneratorTestCodeSnippets.xml"); } do @@ -122,22 +103,9 @@ public static IEnumerable OnCreatedMethodInvokeExpressionTestCases => GetTestCasesFromXml("NotificationMethodGeneratorTests.xml", "GetMethodInvokeExpressionStatementFor1Args", new[] { "comments", "baseMethodNames", "parameters" }); [ - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTests.xml"), TestMethod(), -#if NETFRAMEWORK - DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\NotificationMethodGeneratorTests.xml", "GetMethodInvokeExpressionStatementFor1Args", DataAccessMethod.Sequential)] - public void GetMethodInvokeExpressionStatementForTest() - { - string comments = this.TestContext.DataRow["comments"].ToString(); - string baseMethodNames = this.TestContext.DataRow["baseMethodNames"].ToString(); - string parameters = this.TestContext.DataRow["parameters"].ToString(); - - GetMethodInvokeExpressionStatementForTest(comments, baseMethodNames, parameters); - } -#else DynamicData(nameof(OnCreatedMethodInvokeExpressionTestCases)), ] -#endif public void GetMethodInvokeExpressionStatementForTest(string comments, string baseMethodNames, string parameters) { string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); @@ -176,18 +144,8 @@ public static IEnumerable AddMethodFor1TestCases => GetTestCasesFromXml("NotificationMethodGeneratorTests.xml", "AddMethodFor1Args", new[] { "comments" }); [ - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTests.xml"), TestMethod(), -#if NETFRAMEWORK - DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\NotificationMethodGeneratorTests.xml", "AddMethodFor1Args", DataAccessMethod.Sequential)] - public void AddMethodFor1Test() - { - string comments = this.TestContext.DataRow["comments"].ToString(); - AddMethodFor1Test(comments); - } -#else DynamicData(nameof(AddMethodFor1TestCases))] -#endif public void AddMethodFor1Test(string comments) { AddMethodFor1Test(true, comments); @@ -211,19 +169,8 @@ public static IEnumerable AddMethodFor2TestCases => GetTestCasesFromXml("NotificationMethodGeneratorTests.xml", "AddMethodFor2Args", new[] { "comments", "parameterDeclaration" }); [ - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTests.xml"), TestMethod(), -#if NETFRAMEWORK - DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\NotificationMethodGeneratorTests.xml", "AddMethodFor2Args", DataAccessMethod.Sequential)] - public void AddMethodFor2Test() - { - string comments = this.TestContext.DataRow["comments"].ToString(); - string parameterDeclaration = this.TestContext.DataRow["parameterDeclaration"].ToString(); - AddMethodFor2Test(comments, parameterDeclaration); - } -#else DynamicData (nameof(AddMethodFor2TestCases))] -#endif public void AddMethodFor2Test(string comments, string parameterDeclaration) { @@ -259,20 +206,8 @@ public void AddMethodFor2Test(bool isCSharp, string comments, string paramDeclAr public static IEnumerable AddMethodFor3TestCases => GetTestCasesFromXml("NotificationMethodGeneratorTests.xml", "AddMethodFor3Args", new[] { "comments", "parameters" }); - [ - DeploymentItem("OpenRiaServices.Tools\\Test\\NotificationMethodGeneratorTests.xml"), - TestMethod(), -#if NETFRAMEWORK - DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\NotificationMethodGeneratorTests.xml", "AddMethodFor3Args", DataAccessMethod.Sequential)] - public void AddMethodFor3Test() - { - string comments = this.TestContext.DataRow["comments"].ToString(); - string parameters = this.TestContext.DataRow["parameters"].ToString(); - AddMethodFor2Test(comments, parameters); - } -#else - DynamicData(nameof(AddMethodFor3TestCases))] -#endif + [TestMethod()] + [DynamicData(nameof(AddMethodFor3TestCases))] public void AddMethodFor3Test(string comments, string paramDeclsArgs) { AddMethodFor3Test(true, comments, paramDeclsArgs); diff --git a/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj b/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj index 47442039c..9fa5f5a90 100644 --- a/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj +++ b/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj @@ -20,7 +20,7 @@ - + @@ -29,18 +29,14 @@ + + - - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - Unused @@ -69,10 +65,10 @@ - Always + PreserveNewest - Always + PreserveNewest PreserveNewest diff --git a/src/OpenRiaServices.Tools/Test/TestHelper.cs b/src/OpenRiaServices.Tools/Test/TestHelper.cs index bcbadf92c..25a11afe3 100644 --- a/src/OpenRiaServices.Tools/Test/TestHelper.cs +++ b/src/OpenRiaServices.Tools/Test/TestHelper.cs @@ -12,6 +12,8 @@ using OpenRiaServices.Server.Test.Utilities; using System.Globalization; using Microsoft.Build.Exceptions; +using OpenRiaServices.Tools.Test.Utilities; +using System.Diagnostics; namespace OpenRiaServices.Tools.Test { @@ -40,15 +42,9 @@ public static string GetOutputPath(string projectOutputDir, string baseName) // breadcrumbs we can use to get back to it/ public static void GetProjectPaths(string relativeTestDir, out string projectPath, out string outputPath) { - string projectPathRelativeFileName = Path.Combine(relativeTestDir, "ProjectPath.txt"); - string projectPathFile = GetTestFileName(projectPathRelativeFileName); - projectPath = string.Empty; - outputPath = string.Empty; - string inputString = string.Empty; - using (StreamReader t1 = new StreamReader(projectPathFile)) - { - inputString = t1.ReadToEnd(); - } + // Read file from output folder + string inputString = File.ReadAllText("ProjectPath.txt"); + string[] split = inputString.Split(','); projectPath = split[0]; @@ -131,7 +127,7 @@ public static bool FilesMatch(string relativeTestDir, string relativeDeployDir, private static string StripAutoGenPrefix(string s, string lineCommentStart) { int index = 0; - while(string.Compare(s, index, lineCommentStart, 0, lineCommentStart.Length, StringComparison.Ordinal) == 0) + while (string.Compare(s, index, lineCommentStart, 0, lineCommentStart.Length, StringComparison.Ordinal) == 0) { index = s.IndexOf("\r\n", index, StringComparison.Ordinal) + 2; } @@ -168,7 +164,7 @@ public static string TestDir { get { - return Path.GetDirectoryName(typeof(TestHelper).Assembly.Location); + return TestInitializer.DeploymentDirectory; } } @@ -180,7 +176,7 @@ public static string TestDir public static string NormalizedFolder(string folder) { int len = folder.Length; - return (len > 0 && folder[len-1] == Path.DirectorySeparatorChar) ? folder.Substring(0, folder.Length - 1) : folder; + return (len > 0 && folder[len - 1] == Path.DirectorySeparatorChar) ? folder.Substring(0, folder.Length - 1) : folder; } public static string GetOutputTestDataDir(string subDir) @@ -636,7 +632,7 @@ internal static void GenerateCodeAssertFailure(string language, IEnumerablefalse net472;net6.0 + + + + - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - + - - - \ No newline at end of file diff --git a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj index 91c370a41..f5ec1ce80 100644 --- a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj +++ b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj @@ -11,18 +11,12 @@ - - - - - - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/InvokeOperationTests.cs b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/InvokeOperationTests.cs index 9419767b9..583450066 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/InvokeOperationTests.cs +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/InvokeOperationTests.cs @@ -897,13 +897,13 @@ private void VerifyOnlineMethodReturn(TestProvider_Scenarios provider, Return { DateTime returnedDate = (DateTime)invoke.Value; Assert.AreEqual(((DateTime)(object)inputValue).Kind, returnedDate.Kind); - Assert.AreEqual(inputValue, returnedDate); + Assert.AreEqual((DateTime)(object)inputValue, returnedDate); } else if (TypeUtility.GetNonNullableType(typeof(T)) == typeof(DateTimeOffset)) { DateTimeOffset returnedDate = (DateTimeOffset)invoke.Value; Assert.AreEqual(((DateTimeOffset)(object)inputValue).Offset.Ticks, returnedDate.Offset.Ticks); - Assert.AreEqual(inputValue, returnedDate); + Assert.AreEqual((DateTimeOffset)(object)inputValue, returnedDate); } else if (typeof(T) == typeof(byte[])) { diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/UpdateTests.cs b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/UpdateTests.cs index 2bb97d287..6e2440fe9 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/UpdateTests.cs +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/Data/UpdateTests.cs @@ -25,6 +25,7 @@ namespace OpenRiaServices.Client.Test #if !SILVERLIGHT [TestClass] #endif + [DoNotParallelize] public abstract class UpdateTests : DomainContextTestBase { private static TestDatabase testDatabase = new TestDatabase("Northwind"); @@ -32,7 +33,7 @@ public abstract class UpdateTests : DomainContextTestBase private static int categoryIdSequence; // start with 1000 to avoid collisions with common northwind data private static int regionIdSequence = 100; - public UpdateTests(Uri serviceUri, ProviderType providerType) + protected UpdateTests(Uri serviceUri, ProviderType providerType) : base(serviceUri, providerType) { diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj index 28b471717..5f731401f 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj @@ -10,21 +10,18 @@ - + + + - - - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - diff --git a/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj b/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj index 2f6ad2a30..cf11ebee0 100644 --- a/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj +++ b/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj @@ -14,14 +14,12 @@ - - + + + - - $(MSBuildExtensionsPath)\..\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll -