Skip to content

Commit

Permalink
Windows.Security principal is not supported on non Windows OSs
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimontana82 committed Feb 2, 2024
1 parent a43f784 commit b0d4ea8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace FakeXrmEasy.Core.CommercialLicense
{
/// <summary>
Expand All @@ -16,7 +18,7 @@ internal class UserReader: IUserReader
{
public string GetCurrentUserName()
{
return System.Security.Principal.WindowsIdentity.GetCurrent().Name;
return Environment.UserName;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using FakeXrmEasy.Core.CommercialLicense;
using Xunit;

Expand All @@ -15,7 +16,7 @@ public UserReaderTests()
[Fact]
public void Should_return_current_user()
{
Assert.Equal(System.Security.Principal.WindowsIdentity.GetCurrent().Name, _userReader.GetCurrentUserName());
Assert.Equal(Environment.UserName, _userReader.GetCurrentUserName());
}
}
}

0 comments on commit b0d4ea8

Please sign in to comment.