Skip to content

Commit 9ee7ae5

Browse files
committed
Fixing broken work instruction editor service unit test (LoadForEditAsync_NotFound_ShouldThrow) to comply with exception type changed to KeyNotFoundException
1 parent f5846a5 commit 9ee7ae5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

MESS/MESS.Tests/Services/WorkInstructionEditorServiceTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,13 @@ public async Task LoadForEditAsync_ShouldLoadExistingInstruction()
8484
[Fact]
8585
public async Task LoadForEditAsync_NotFound_ShouldThrow()
8686
{
87-
_mockWorkInstructionService.Setup(s => s.GetFormByIdAsync(99)).ReturnsAsync((WorkInstructionFormDTO?)null);
87+
_mockWorkInstructionService
88+
.Setup(s => s.GetFormByIdAsync(99))
89+
.ReturnsAsync((WorkInstructionFormDTO?)null);
90+
91+
var ex = await Assert.ThrowsAsync<KeyNotFoundException>(() => _sut.LoadForEditAsync(99));
8892

89-
await Assert.ThrowsAsync<Exception>(() => _sut.LoadForEditAsync(99));
93+
Assert.Equal("Work instruction with id 99 was not found.", ex.Message);
9094
}
9195

9296
[Fact]

0 commit comments

Comments
 (0)