public async Task GetCorrectProfilePaths()
        {
            using var kernel = new PowerShellKernel().UseProfiles();

            // Set variables we will retrieve later.
            await kernel.SubmitCodeAsync("$currentUserCurrentHost = $PROFILE.CurrentUserCurrentHost");

            await kernel.SubmitCodeAsync("$allUsersCurrentHost = $PROFILE.AllUsersCurrentHost");

            kernel.TryGetValue("currentUserCurrentHost", out object profileObj).Should().BeTrue();
            profileObj.Should().BeOfType <string>();
            string currentUserCurrentHost = profileObj.As <string>();

            // Get $PROFILE default.
            kernel.TryGetValue("PROFILE", out profileObj).Should().BeTrue();
            profileObj.Should().BeOfType <string>();
            string profileDefault = profileObj.As <string>();

            // Check that $PROFILE is not null or empty and it is the same as
            // $PROFILE.CurrentUserCurrentHost
            profileDefault.Should().NotBeNullOrEmpty();
            profileDefault.Should().Be(currentUserCurrentHost);

            kernel.TryGetValue("allUsersCurrentHost", out profileObj).Should().BeTrue();
            profileObj.Should().BeOfType <string>();
            string allUsersCurrentHost = profileObj.As <string>();

            // Check that $PROFILE.AllUsersCurrentHost is what we expect it is:
            // $PSHOME + Microsoft.dotnet-interactive_profile.ps1
            allUsersCurrentHost.Should().Be(_allUsersCurrentHostProfilePath);
        }
        public async Task TryGetVariable_unwraps_PowerShell_object(string code, Type expectedType)
        {
            using var kernel = new PowerShellKernel();

            await kernel.SubmitCodeAsync(code);

            kernel.TryGetValue("x", out object fi).Should().BeTrue();

            fi.Should().BeOfType(expectedType);
        }
        public async Task VerifyAllUsersProfileRuns()
        {
            var randomVariableName = Path.GetRandomFileName().Split('.')[0];

            File.WriteAllText(_allUsersCurrentHostProfilePath, $"$global:{randomVariableName} = $true");

            try
            {
                using var kernel = new PowerShellKernel().UseProfiles();

                // trigger first time setup.
                await kernel.SubmitCodeAsync("Get-Date");

                kernel.TryGetValue(randomVariableName, out object profileObj).Should().BeTrue();

                profileObj.Should().BeOfType <bool>();
                profileObj.As <bool>().Should().BeTrue();
            }
            finally
            {
                File.Delete(_allUsersCurrentHostProfilePath);
            }
        }