Use WindowsIdentity instead of environment variables to verify NTLM auth scenarios

This is required to fix tests when tests are run under a system account.
This commit is contained in:
Pranav K 2016-10-28 11:21:44 -07:00
parent 843bae083e
commit f70313c17a
1 changed files with 6 additions and 4 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -121,8 +122,9 @@ namespace E2ETests
//Check if the user name appears in the page //Check if the user name appears in the page
Assert.Contains( Assert.Contains(
string.Format("{0}\\{1}", Environment.GetEnvironmentVariable("USERDOMAIN"), Environment.GetEnvironmentVariable("USERNAME")), WindowsIdentity.GetCurrent().Name,
homePageContent, StringComparison.OrdinalIgnoreCase); homePageContent,
StringComparison.OrdinalIgnoreCase);
} }
public void ValidateLayoutPage(string responseContent) public void ValidateLayoutPage(string responseContent)