-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2710 - Return macOS instead of 'Darwin' and return proper version (
#3956) * Initial commit * Finish * Update CHANGELOG.md * Update CHANGELOG.md * Update Sentry.Maui.Device.TestApp.csproj * Update EnricherTests.cs * Update CHANGELOG.md
- Loading branch information
Showing
5 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#if NET6_0_OR_GREATER | ||
using Sentry.Tests; | ||
|
||
namespace Sentry.Maui.Tests; | ||
|
||
public class EnricherTests | ||
{ | ||
[PlatformFact(Platform.MacOS)] | ||
public void macOS_Platform_Version() | ||
{ | ||
var elike = Substitute.For<IEventLike>(); | ||
elike.Sdk.Returns(new SdkVersion()); | ||
elike.User = new SentryUser(); | ||
elike.Contexts = new SentryContexts(); | ||
|
||
var enricher = new Enricher(new SentryOptions()); | ||
enricher.Apply(elike); | ||
|
||
var os = elike.Contexts.OperatingSystem; | ||
os.Name.Should().Be("macOS"); | ||
os.Version.Should().Be(Environment.OSVersion.Version.ToString()); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace Sentry.Tests; | ||
|
||
public enum Platform | ||
{ | ||
Windows, | ||
Linux, | ||
MacOS | ||
} | ||
|
||
public class PlatformFact : FactAttribute | ||
{ | ||
public PlatformFact(Platform platform) | ||
{ | ||
var actual = platform switch | ||
{ | ||
Platform.Windows => OSPlatform.Windows, | ||
Platform.Linux => OSPlatform.Linux, | ||
Platform.MacOS => OSPlatform.OSX, | ||
_ => throw new NotSupportedException() | ||
}; | ||
|
||
if (!RuntimeInformation.IsOSPlatform(actual)) | ||
Skip = "Ignored - Not Platform: " + actual; | ||
} | ||
} |