Ejemplo n.º 1
0
 public void OSOptionCannotBeCombinedWithRuntime()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath     = "<msbuildpath>";
         var exceptionThrown = Assert.Throws <GracefulException>(() => BuildCommand.FromArgs(new string[] { "--os", "os", "--runtime", "rid" }, msbuildPath));
         exceptionThrown.Message.Should().Be(CommonLocalizableStrings.CannotSpecifyBothRuntimeAndOsOptions);
     });
 }
Ejemplo n.º 2
0
 public void OptionsRespectUserSpecifiedSelfContained()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath = "<msbuildpath>";
         var command     = BuildCommand.FromArgs(new string[] { "--arch", "arch", "--os", "os", "--self-contained" }, msbuildPath);
         command.GetArgumentsToMSBuild()
         .Should()
         .StartWith($"{ExpectedPrefix} -restore -consoleloggerparameters:Summary -property:SelfContained=True -property:_CommandLineDefinedSelfContained=true -property:RuntimeIdentifier=os-arch");
     });
 }
Ejemplo n.º 3
0
 public void OSAndArchOptionsCanBeCombined()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath = "<msbuildpath>";
         var command     = BuildCommand.FromArgs(new string[] { "--arch", "arch", "--os", "os" }, msbuildPath);
         command.GetArgumentsToMSBuild()
         .Should()
         .StartWith($"{ExpectedPrefix} -restore -consoleloggerparameters:Summary -property:RuntimeIdentifier=os-arch -property:SelfContained=false");
     });
 }
Ejemplo n.º 4
0
 public void OsOptionIsCorrectlyResolved()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath  = "<msbuildpath>";
         var command      = BuildCommand.FromArgs(new string[] { "--os", "os" }, msbuildPath);
         var expectedArch = RuntimeInformation.ProcessArchitecture.Equals(Architecture.Arm64) ? "arm64" : Environment.Is64BitOperatingSystem ? "x64" : "x86";
         command.GetArgumentsToMSBuild()
         .Should()
         .StartWith($"{ExpectedPrefix} -restore -consoleloggerparameters:Summary -property:RuntimeIdentifier=os-{expectedArch} -property:SelfContained=false");
     });
 }
Ejemplo n.º 5
0
 public void ItDoesNotUseImplicitRidWhenOneIsSpecifiedForSelfContained()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath = "<msbuildpath>";
         var currentRid  = CommonOptions.GetCurrentRuntimeId();
         var command     = BuildCommand.FromArgs(new string[] { "--self-contained", "--runtime", "fake-rid" }, msbuildPath);
         command.GetArgumentsToMSBuild()
         .Should()
         .StartWith($"{ExpectedPrefix} -restore -consoleloggerparameters:Summary " +
                    $"-property:RuntimeIdentifier=fake-rid -property:_CommandLineDefinedRuntimeIdentifier=true " +
                    $"-property:SelfContained=True -property:_CommandLineDefinedSelfContained=true");
     });
 }
Ejemplo n.º 6
0
 public void ArchOptionIsCorrectlyResolved()
 {
     CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
     {
         var msbuildPath = "<msbuildpath>";
         var command     = BuildCommand.FromArgs(new string[] { "--arch", "arch" }, msbuildPath);
         var expectedOs  = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "win" :
                           RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "linux" :
                           RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "osx" :
                           null;
         if (expectedOs == null)
         {
             // Not a supported OS for running test
             return;
         }
         command.GetArgumentsToMSBuild()
         .Should()
         .StartWith($"{ExpectedPrefix} -restore -consoleloggerparameters:Summary -property:RuntimeIdentifier={expectedOs}-arch -property:SelfContained=false");
     });
 }