File: Microsoft\VisualBasic\ApplicationServices\UserTests.cs
Web Access
Project: src\src\Microsoft.VisualBasic\tests\UnitTests\Microsoft.VisualBasic.Tests.csproj (Microsoft.VisualBasic.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace Microsoft.VisualBasic.ApplicationServices.Tests;
 
public class UserTests
{
    [Fact]
    public void Properties()
    {
        User user = new();
        Assert.Equal(System.Threading.Thread.CurrentPrincipal, user.CurrentPrincipal);
        if (user.CurrentPrincipal is not null)
        {
            Assert.Equal(System.Threading.Thread.CurrentPrincipal.Identity.Name, user.Name);
            Assert.Equal(System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated, user.IsAuthenticated);
            Assert.Equal(System.Threading.Thread.CurrentPrincipal.IsInRole("Guest"), user.IsInRole("Guest"));
        }
    }
}