Update reference to use packages from NuGet.org (#7525)

Update psrp and libpsl reference to Microsoft.PowerShell.Native
Keep the reference to powershell.myget.org in nuget.config for PSDesiredStateConfiguration and PowerShellHelpFiles
Update hosting tests
Update hosting.tests.csproj in preparation on next release with version 6.1.0-rc.1
Update Microsoft.Management.Infrastructure to version 1.0.0
This commit is contained in:
Aditya Patwardhan
2018-08-16 15:56:15 -07:00
committed by Travis Plunk
parent a746fd29ec
commit 96b2c83c59
6 changed files with 98 additions and 12 deletions
@@ -21,8 +21,8 @@
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0" />
<!-- the following package(s) are from the powershell org -->
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0-alpha*" />
<PackageReference Include="PowerShell.Core.Instrumentation" Version="6.0.0-beta*" />
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.PowerShell.Native" Version="6.1.0-rc.1" />
</ItemGroup>
<PropertyGroup>
@@ -31,8 +31,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="libpsl" Version="6.0.0-*" />
<PackageReference Include="psrp" Version="1.4.5-*" />
<PackageReference Include="PSDesiredStateConfiguration" Version="6.0.0-beta.8" />
<PackageReference Include="PowerShellHelpFiles" Version="1.0.0-*" />
</ItemGroup>
@@ -24,10 +24,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="..\powershell-win-core\pwsh-preview.cmd">
<Link>preview\pwsh-preview.cmd</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\powershell-win-core\pwsh-preview.cmd">
<Link>preview\pwsh-preview.cmd</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
@@ -40,7 +40,6 @@
<ItemGroup>
<PackageReference Include="PSDesiredStateConfiguration" Version="6.0.0-beta.8" />
<PackageReference Include="PowerShellHelpFiles" Version="1.0.0-*" />
<PackageReference Include="psrp.windows" Version="6.1.0-*" />
</ItemGroup>
</Project>
-1
View File
@@ -2,7 +2,6 @@
<configuration>
<packageSources>
<clear />
<add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
+3 -1
View File
@@ -18,7 +18,9 @@
<PackageReference Include="xunit" Version="2.4.0" />
<!-- DotNetCliToolReference element specifies the CLI tool that the user wants to restore in the context of the project. -->
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.2" />
<!-- The version of Microsoft.PowerShell.SDK should be the version we are releasing, so the tests use the correct SDK before publishing to NuGet.org -->
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0-rc.1" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.6" />
</ItemGroup>
</Project>
+89 -1
View File
@@ -1,9 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Xunit;
using System;
using System.IO;
using System.Management.Automation;
using System.Security;
using Microsoft.Management.Infrastructure;
using Xunit;
namespace PowerShell.Hosting.SDK.Tests
{
@@ -51,5 +54,90 @@ namespace PowerShell.Hosting.SDK.Tests
}
}
}
[SkippableFact]
public static void TestCommandFromMMI()
{
// Test is disabled since we do not have a CimCmdlets module released in the SDK.
Skip.IfNot(Platform.IsWindows);
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
var results = ps.AddScript("[Microsoft.Management.Infrastructure.CimInstance]::new('Win32_Process')").Invoke();
Assert.True(results.Count > 0);
}
}
[SkippableFact]
public static void TestCommandFromDiagnostics()
{
Skip.IfNot(Platform.IsWindows);
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
var results = ps.AddScript("Get-WinEvent -ListLog Application").Invoke();
foreach (dynamic item in results)
{
Assert.Equal("Application", item.LogName);
}
}
}
[SkippableFact]
public static void TestCommandFromSecurity()
{
Skip.IfNot(Platform.IsWindows);
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
var results = ps.AddScript("ConvertTo-SecureString -String test -AsPlainText -Force").Invoke<SecureString>();
Assert.IsType<SecureString>(results[0]);
}
}
[SkippableFact]
public static void TestCommandFromWSMan()
{
Skip.IfNot(Platform.IsWindows);
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
var results = ps.AddScript("Test-WSMan").Invoke();
foreach (dynamic item in results)
{
Assert.Equal("Microsoft Corporation", item.ProductVendor);
}
}
}
[Fact]
public static void TestCommandFromNative()
{
var fs = File.Create(Path.GetTempFileName());
fs.Close();
string target = fs.Name;
string path = Path.GetTempFileName();
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
// New-Item -ItemType SymbolicLink uses libpsl-native, hence using it for validating native dependencies.
string command = $"New-Item -ItemType SymbolicLink -Path {path} -Target {target}";
var results = ps.AddScript(command).Invoke<FileInfo>();
foreach (var item in results)
{
Assert.Equal(path, item.FullName);
}
}
if (File.Exists(path))
{
File.Delete(path);
}
if (File.Exists(target))
{
File.Delete(target);
}
}
}
}