Skip to content

Commit

Permalink
Validation tests 1.2
Browse files Browse the repository at this point in the history
Verbeterde versie van de vorige code. validation tests worden nu allemaal uitgevoerd uit een testmethod
  • Loading branch information
Alihanaslan75 committed Jan 20, 2025
1 parent 5541cd3 commit 9603969
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions UnitTest/ItemStorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,14 @@ public async Task TestValidateItems_AllValid()
[TestMethod]
public async Task ValidateItems_False()
{
// Arrange
await _dbContext.ItemTypes.AddAsync(TestHelper.TestItemType1WithId);
await _dbContext.ItemGroups.AddAsync(TestHelper.TestItemGroup1WithId);
await _dbContext.ItemLines.AddAsync(TestHelper.TestItemLine1WithId);
await _dbContext.SaveChangesAsync();

// Act
var isNotValid = await _itemStorageService.ValidateItems(1, 1, 2);
var isNotValid2 = await _itemStorageService.ValidateItems(1, 2, 1);
var isNotValid3 = await _itemStorageService.ValidateItems(2, 1, 1);
var isNotValid4 = await _itemStorageService.ValidateItems(2, 2, 2);


// Assert
Assert.IsFalse(isNotValid);
Assert.IsFalse(isNotValid2);
Assert.IsFalse(isNotValid3);
Assert.IsFalse(isNotValid4);
Assert.IsFalse(await _itemStorageService.ValidateItems(1, 1, 2)); //itemLine
Assert.IsFalse(await _itemStorageService.ValidateItems(1, 2, 1)); //itemGroup
Assert.IsFalse(await _itemStorageService.ValidateItems(2, 1, 1)); //itemType
Assert.IsFalse(await _itemStorageService.ValidateItems(2, 2, 2)); //All fail
}
}

0 comments on commit 9603969

Please sign in to comment.