Skip to content

Commit

Permalink
Fix macOS test
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt committed Apr 14, 2020
1 parent 7f69728 commit b9881e0
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ public void VerifyWindows()
Assert.Equal(Platform.Windows, RuntimeEnvironment.OperatingSystemPlatform);
Assert.Equal("Windows", RuntimeEnvironment.OperatingSystem);

VerifyOperatingSystemVersionEqualsEnvironmentOSVersion();
Version osVersion = Version.Parse(RuntimeEnvironment.OperatingSystemVersion);
Version expectedOSVersion = Environment.OSVersion.Version;

Assert.Equal(expectedOSVersion.Major, osVersion.Major);
Assert.Equal(expectedOSVersion.Minor, osVersion.Minor);
Assert.Equal(expectedOSVersion.Build, osVersion.Build);
}

[MacOsOnlyFact]
Expand All @@ -30,17 +35,10 @@ public void VerifyMacOs()
Assert.Equal(Platform.Darwin, RuntimeEnvironment.OperatingSystemPlatform);
Assert.Equal("Mac OS X", RuntimeEnvironment.OperatingSystem);

VerifyOperatingSystemVersionEqualsEnvironmentOSVersion();
}

private void VerifyOperatingSystemVersionEqualsEnvironmentOSVersion()
{
Version osVersion = Version.Parse(RuntimeEnvironment.OperatingSystemVersion);
Version expectedOSVersion = Environment.OSVersion.Version;

Assert.Equal(expectedOSVersion.Major, osVersion.Major);
Assert.Equal(expectedOSVersion.Minor, osVersion.Minor);
Assert.Equal(expectedOSVersion.Build, osVersion.Build);
Assert.Equal(10, osVersion.Major);
Assert.Equal(Environment.OSVersion.Version.Major - 4, osVersion.Minor);
}

[LinuxOnlyFact]
Expand Down

0 comments on commit b9881e0

Please sign in to comment.