Skip to content

Commit

Permalink
Fixed CodeQL warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pmachapman committed Dec 15, 2024
1 parent 13226aa commit 90e46eb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/SIL.XForge.Scripture.Tests/Services/SFProjectServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4133,47 +4133,56 @@ public void GetEventMetrics_InvalidProject()
public async Task GetEventMetrics_ProjectAdmin()
{
var env = new TestEnvironment();
IEnumerable<EventMetric> expected = [new EventMetric()];
env.EventMetricService.GetEventMetrics(Project01, pageIndex: 0, pageSize: 10).Returns(expected);

// SUT
IEnumerable<EventMetric> _ = await env.Service.GetEventMetricsAsync(
IEnumerable<EventMetric> actual = await env.Service.GetEventMetricsAsync(
User01,
systemRoles: [SystemRole.User],
Project01,
pageIndex: 0,
pageSize: 10
);
Assert.AreEqual(expected, actual);
env.EventMetricService.Received().GetEventMetrics(Project01, pageIndex: 0, pageSize: 10);
}

[Test]
public async Task GetEventMetrics_ServalAdmin()
{
var env = new TestEnvironment();
IEnumerable<EventMetric> expected = [new EventMetric()];
env.EventMetricService.GetEventMetrics(Project01, pageIndex: 0, pageSize: 10).Returns(expected);

// SUT
IEnumerable<EventMetric> _ = await env.Service.GetEventMetricsAsync(
IEnumerable<EventMetric> actual = await env.Service.GetEventMetricsAsync(
User06,
systemRoles: [SystemRole.ServalAdmin],
Project01,
pageIndex: 0,
pageSize: 10
);
Assert.AreEqual(expected, actual);
env.EventMetricService.Received().GetEventMetrics(Project01, pageIndex: 0, pageSize: 10);
}

[Test]
public async Task GetEventMetrics_SystemAdmin()
{
var env = new TestEnvironment();
IEnumerable<EventMetric> expected = [new EventMetric()];
env.EventMetricService.GetEventMetrics(Project01, pageIndex: 0, pageSize: 10).Returns(expected);

// SUT
IEnumerable<EventMetric> _ = await env.Service.GetEventMetricsAsync(
IEnumerable<EventMetric> actual = await env.Service.GetEventMetricsAsync(
User06,
systemRoles: [SystemRole.SystemAdmin],
Project01,
pageIndex: 0,
pageSize: 10
);
Assert.AreEqual(expected, actual);
env.EventMetricService.Received().GetEventMetrics(Project01, pageIndex: 0, pageSize: 10);
}

Expand Down

0 comments on commit 90e46eb

Please sign in to comment.