adding Store support to testfixture
authorRama Krishnan Raghupathy <ramarag@microsoft.com>
Fri, 26 May 2017 01:44:40 +0000 (18:44 -0700)
committerRama Krishnan Raghupathy <ramarag@microsoft.com>
Fri, 26 May 2017 20:59:32 +0000 (13:59 -0700)
Commit migrated from https://github.com/dotnet/core-setup/commit/a5ac221ff6ebf6e8be292289f37946a5cbcaff72

src/installer/test/TestUtils/DotNetCli.cs
src/installer/test/TestUtils/TestProjectFixture.cs

index 60b1828..48b4637 100644 (file)
@@ -41,6 +41,8 @@ namespace Microsoft.DotNet.Cli.Build
         public Command Test(params string[] args) => Exec("test", args);
         public Command Publish(params string[] args) => Exec("publish", args);
 
+        public Command Store(params string[] args) => Exec("store", args);
+
         private void ComputeSharedFxPaths()
         {
             var sharedFxBaseDirectory = Path.Combine(BinPath, "shared", "Microsoft.NETCore.App");
index e219fa9..8dd2dd2 100644 (file)
@@ -235,6 +235,65 @@ namespace Microsoft.DotNet.CoreSetup.Test
             return this;
         }
 
+        public TestProjectFixture StoreProject(
+            DotNetCli dotnet = null,
+            string runtime = null,
+            string framework = "netcoreapp2.0",
+            string manifest = null,
+            string outputDirectory = null)
+        {
+            dotnet = dotnet ?? _sdkDotnet;
+            outputDirectory = outputDirectory ?? _testProject.OutputDirectory;
+
+            var storeArgs = new List<string>();
+            storeArgs.Add("--runtime");
+            if (runtime != null)
+            {
+                storeArgs.Add(runtime);
+            }
+            else
+            {
+               storeArgs.Add(CurrentRid);
+            }
+
+            if (framework != null)
+            {
+                storeArgs.Add("--framework");
+                storeArgs.Add(framework);
+            }
+
+                storeArgs.Add("--manifest");
+            if (manifest != null)
+            {
+                storeArgs.Add(manifest);
+            }
+            else
+            {
+                 storeArgs.Add(_sourceTestProject.ProjectFile);
+            }
+
+            if (outputDirectory != null)
+            {
+                storeArgs.Add("-o");
+                storeArgs.Add(outputDirectory);
+            }
+
+            storeArgs.Add("--working-dir");
+            storeArgs.Add("store_workin_dir");
+
+            dotnet.Store(storeArgs.ToArray())
+                .WorkingDirectory(_testProject.ProjectDirectory)
+                .Environment("NUGET_PACKAGES", _repoDirectoriesProvider.NugetPackages)
+                .CaptureStdErr()
+                .CaptureStdOut()
+                .Execute()
+                .EnsureSuccessful();
+
+            _testProject.LoadOutputFiles();
+
+            return this;
+        }
+
         public TestProjectFixture PublishProject(
             DotNetCli dotnet = null,
             string runtime = null,