Skip to content

Commit

Permalink
TestGetAllMax
Browse files Browse the repository at this point in the history
test get maar dan met een limit
  • Loading branch information
Alihanaslan75 committed Jan 20, 2025
1 parent 9603969 commit e6c8896
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions UnitTest/ItemTypesServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ public async Task TestGetAllItemTypes()
Assert.AreEqual(2, result.Count);
}

[TestMethod]
public async Task TestGetAllMax()
{
for (int i = 0; i < 300; i++)
{
ItemType randomType = TestHelper.CreateRandomItemType();
await _dbContext.ItemTypes.AddAsync(randomType);
}
await _dbContext.SaveChangesAsync();

var result = await _baseStorageService.GetAllRows<ItemType>(1, 100);
Assert.AreEqual(100, result.Count);
Assert.IsTrue(result.All(type => type.Id <= 100));
}

[TestMethod]
public async Task TestPostItemTypes()
{
Expand Down
9 changes: 9 additions & 0 deletions UnitTest/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,13 @@ public static ItemLine CreateRandomItemLine()
Name = "Test Line",
Description = "Line Description"
};

public static ItemType CreateRandomItemType()
{
return new ItemType
{
Name = Guid.NewGuid().ToString(),
Description = Guid.NewGuid().ToString()
};
}
}

0 comments on commit e6c8896

Please sign in to comment.