Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Aug 15, 2024
1 parent 68664a6 commit 56557f8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/unit/ComputerSessionProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,26 @@ public async Task ComputerSessionProcessor_TestTimeout() {
Assert.Single(receivedStatus);
var status = receivedStatus[0];
Assert.Equal("Timeout", status.Status);
}

[Fact]
public async Task ComputerSessionProcessor_TestTimeoutPrivileged() {
var nativeMethods = new Mock<NativeMethods>();
nativeMethods.Setup(x => x.NetWkstaUserEnum(It.IsAny<string>())).Callback(() => {
Thread.Sleep(200);
}).Returns(Array.Empty<NetWkstaUserEnumResults>());
var processor = new ComputerSessionProcessor(new MockLdapUtils(),"", nativeMethods.Object);
var receivedStatus = new List<CSVComputerStatus>();
var machineDomainSid = $"{Consts.MockDomainSid}-1000";
processor.ComputerStatusEvent += async status => {

Check warning on line 266 in test/unit/ComputerSessionProcessorTest.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 266 in test/unit/ComputerSessionProcessorTest.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
receivedStatus.Add(status);
};

receivedStatus.Clear();

results = await processor.ReadUserSessionsPrivileged("primary.testlab.local", machineDomainSid, "testlab.local",
var results = await processor.ReadUserSessionsPrivileged("primary.testlab.local", machineDomainSid, "testlab.local",
TimeSpan.FromMilliseconds(1));
Assert.Empty(results.Results);
Assert.Single(receivedStatus);
status = receivedStatus[0];
var status = receivedStatus[0];
Assert.Equal("Timeout", status.Status);
}
}
Expand Down

0 comments on commit 56557f8

Please sign in to comment.