diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs index 62ef0cb959..048a180206 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs @@ -17,10 +17,25 @@ public class DisableAppdomainTests : AcceptanceTestBase public void DisableAppdomainTest(RunnerInfo runnerInfo) { SetTestEnvironment(this.testEnvironment, runnerInfo); - RunTests(runnerInfo.RunnerFramework); + + var diableAppdomainTest1 = testEnvironment.GetTestAsset("DisableAppdomainTest1.dll", "net451"); + var diableAppdomainTest2 = testEnvironment.GetTestAsset("DisableAppdomainTest2.dll", "net451"); + + RunTests(runnerInfo.RunnerFramework, string.Format("{0}\" \"{1}", diableAppdomainTest1, diableAppdomainTest2), 2); + } + + [TestMethod] + [NetFullTargetFrameworkDataSource] + public void NewtonSoftDependencyWithDisableAppdomainTest(RunnerInfo runnerInfo) + { + SetTestEnvironment(this.testEnvironment, runnerInfo); + + var newtonSoftDependnecyTest = testEnvironment.GetTestAsset("NewtonSoftDependency.dll", "net451"); + + RunTests(runnerInfo.RunnerFramework, newtonSoftDependnecyTest, 1); } - private void RunTests(string runnerFramework) + private void RunTests(string runnerFramework, string testAssembly, int passedTestCount) { if (runnerFramework.StartsWith("netcoreapp")) { @@ -36,13 +51,13 @@ private void RunTests(string runnerFramework) var diableAppdomainTest1 = testEnvironment.GetTestAsset("DisableAppdomainTest1.dll", "net451"); var diableAppdomainTest2 = testEnvironment.GetTestAsset("DisableAppdomainTest2.dll", "net451"); var arguments = PrepareArguments( - string.Format("{0}\" \"{1}", diableAppdomainTest1, diableAppdomainTest2), + testAssembly, string.Empty, GetRunsettingsFilePath(runConfigurationDictionary), this.FrameworkArgValue); this.InvokeVsTest(arguments); - this.ValidateSummaryStatus(2, 0, 0); + this.ValidateSummaryStatus(passedTestCount, 0, 0); } private string GetRunsettingsFilePath(Dictionary runConfigurationDictionary) diff --git a/test/TestAssets/NewtonSoftDependency/App.config b/test/TestAssets/NewtonSoftDependency/App.config new file mode 100644 index 0000000000..776d09c68c --- /dev/null +++ b/test/TestAssets/NewtonSoftDependency/App.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj b/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj new file mode 100644 index 0000000000..6c6d7139b4 --- /dev/null +++ b/test/TestAssets/NewtonSoftDependency/NewtonSoftDependency.csproj @@ -0,0 +1,34 @@ + + + + + ..\..\..\ + true + + + + + + NewtonSoftDependency + net451 + Exe + + + + + + + + + + + + + + + + + + + + diff --git a/test/TestAssets/NewtonSoftDependency/UnitTest1.cs b/test/TestAssets/NewtonSoftDependency/UnitTest1.cs new file mode 100644 index 0000000000..522f819653 --- /dev/null +++ b/test/TestAssets/NewtonSoftDependency/UnitTest1.cs @@ -0,0 +1,26 @@ + +namespace NewtonSoftDependency +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Newtonsoft.Json; + + public class Account + { + public string Email { get; set; } + public bool Active { get; set; } + } + + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + string json = @"{'Email': 'john@example.com', 'Active': true}"; + + Account account = JsonConvert.DeserializeObject(json); + + Assert.AreEqual("john@example.com", account.Email); + } + } +} diff --git a/test/TestAssets/TestAssets.sln/TestAssets.sln b/test/TestAssets/TestAssets.sln/TestAssets.sln index 7e8dbe146c..8e6ec13ca3 100644 --- a/test/TestAssets/TestAssets.sln/TestAssets.sln +++ b/test/TestAssets/TestAssets.sln/TestAssets.sln @@ -43,6 +43,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleManagedApp", "..\Con EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LegacySettingsUnitTestProject", "..\LegacySettingsUnitTestProject\LegacySettingsUnitTestProject.csproj", "{8C38E692-FBE3-41A4-A008-4CA79B203985}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewtonSoftDependency", "..\NewtonSoftDependency\NewtonSoftDependency.csproj", "{79EDA259-5EA0-45F0-990A-F078427E198A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -129,6 +131,10 @@ Global {8C38E692-FBE3-41A4-A008-4CA79B203985}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C38E692-FBE3-41A4-A008-4CA79B203985}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C38E692-FBE3-41A4-A008-4CA79B203985}.Release|Any CPU.Build.0 = Release|Any CPU + {79EDA259-5EA0-45F0-990A-F078427E198A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79EDA259-5EA0-45F0-990A-F078427E198A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79EDA259-5EA0-45F0-990A-F078427E198A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79EDA259-5EA0-45F0-990A-F078427E198A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE