Skip to content

Commit fc2eb29

Browse files
Improve coverage
- Increase limits to get more coverage. - Validate the project ID.
1 parent b0046df commit fc2eb29

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/MartinCostello.BrowserStack.Automate.Tests/BrowserStackAutomateClientTests.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static async Task Can_Query_BrowserStack_Automate_Api()
6767
sessions.ShouldNotContain((p) => p == null);
6868

6969
// Limit the sessions for performance
70-
foreach (var session in sessions.Take(1))
70+
foreach (var session in sessions.Take(10))
7171
{
7272
AssertSession(session, build.Name);
7373

@@ -110,7 +110,7 @@ public static async Task Can_Query_BrowserStack_Automate_Api()
110110
}
111111

112112
// Arrange
113-
limit = 5;
113+
limit = 10;
114114
offset = 1;
115115
status = null;
116116

@@ -144,7 +144,7 @@ public static async Task Can_Query_BrowserStack_Automate_Api()
144144
}
145145

146146
// Arrange
147-
limit = 5;
147+
limit = 10;
148148
status = SessionStatuses.Done;
149149

150150
// Act
@@ -180,7 +180,7 @@ public static async Task Can_Query_BrowserStack_Automate_Api()
180180
}
181181

182182
// Arrange
183-
limit = 5;
183+
limit = 10;
184184
offset = 1;
185185
status = null;
186186

@@ -708,6 +708,24 @@ public static async Task GetBuildsAsync_Throws_If_Offset_Is_Less_Than_Zero()
708708
error.ActualValue.ShouldBe(-1);
709709
}
710710

711+
[Fact]
712+
public static async Task GetBuildsAsync_Throws_If_ProjectId_Is_Less_Than_One()
713+
{
714+
// Arrange
715+
using var target = CreateClient();
716+
717+
int? limit = 1;
718+
int? offset = 1;
719+
string? status = null;
720+
int? projectId = -1;
721+
722+
// Act and Assert
723+
var error = await Assert.ThrowsAsync<ArgumentOutOfRangeException>("projectId", () => target.GetBuildsAsync(limit, offset, status, projectId));
724+
725+
error.Message.ShouldStartWith("The projectId value cannot be less than one.");
726+
error.ActualValue.ShouldBe(-1);
727+
}
728+
711729
[Fact]
712730
public static async Task GetSessionsAsync_Throws_If_Offset_Is_Less_Than_Zero()
713731
{

0 commit comments

Comments
 (0)