mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Remove some unused runtime properties and add some tests
This commit is contained in:
43
test/Velopack.Tests/RuntimeInfoTests.cs
Normal file
43
test/Velopack.Tests/RuntimeInfoTests.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
public class RuntimeInfoTests
|
||||
{
|
||||
[Fact]
|
||||
public void NugetVersionAgreesWithNbgv()
|
||||
{
|
||||
var args = new List<string> { "get-version", "-v", "NuGetPackageVersion" };
|
||||
var current = new ProcessStartInfo("nbgv", args).Output(5000);
|
||||
Assert.Equal(current, VelopackRuntimeInfo.VelopackNugetVersion.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlatformIsCorrect()
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
Assert.True(VelopackRuntimeInfo.IsWindows);
|
||||
Assert.Equal(RuntimeOs.Windows, VelopackRuntimeInfo.SystemOs);
|
||||
#else
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
||||
Assert.True(VelopackRuntimeInfo.IsWindows);
|
||||
Assert.Equal(RuntimeOs.Windows, VelopackRuntimeInfo.SystemOs);
|
||||
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
|
||||
Assert.True(VelopackRuntimeInfo.IsLinux);
|
||||
Assert.Equal(RuntimeOs.Linux, VelopackRuntimeInfo.SystemOs);
|
||||
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
|
||||
Assert.True(VelopackRuntimeInfo.IsOSX);
|
||||
Assert.Equal(RuntimeOs.OSX, VelopackRuntimeInfo.SystemOs);
|
||||
} else {
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user