Skip to content

Commit 32a06fd

Browse files
Added test for exception case of SetMaxDecibelsAsync.
1 parent 7f391b4 commit 32a06fd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/IntegrationTests/AudioNodeTests/AnalyserNodeTest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,26 @@ public async Task SetMaxDecibelsAsync_ShouldUpdateMaxDecibels(double maxDecibels
227227
double readMaxDecibels = await node.GetMaxDecibelsAsync();
228228
_ = readMaxDecibels.Should().Be(maxDecibels);
229229
}
230+
231+
[Test]
232+
[TestCase(-100, -110)]
233+
[TestCase(50, 0)]
234+
public async Task SetMaxDecibelsAsync_ThrowsIndexSizeErrorException_WhenSetLowerThanMinDecibels(double minDecibels, double maxDecibels)
235+
{
236+
// Arrange
237+
await using AudioContext context = await GetAudioContextAsync();
238+
239+
await using AnalyserNode node = await AnalyserNode.CreateAsync(JSRuntime, context, new()
240+
{
241+
MinDecibels = minDecibels,
242+
MaxDecibels = minDecibels + 1,
243+
});
244+
245+
// Act
246+
247+
Func<Task> action = async () => await node.SetMaxDecibelsAsync(maxDecibels);
248+
249+
// Assert
250+
_ = await action.Should().ThrowAsync<IndexSizeErrorException>();
251+
}
230252
}

0 commit comments

Comments
 (0)