Skip to content

Commit 927d224

Browse files
Added tests for ChannelSplitterNode.
1 parent 13a64e3 commit 927d224

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/KristofferStrube.Blazor.WebAudio/Options/ChannelSplitterOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class ChannelSplitterOptions : AudioNodeOptions
2929
/// The number inputs for the <see cref="ChannelSplitterNode"/>.
3030
/// </summary>
3131
/// <remarks>
32+
/// The default value is <c>6</c>.<br />
3233
/// It throws an <see cref="IndexSizeErrorException"/> if it is less than <c>1</c> or larger than the supported number of channels when used for constructing a <see cref="ChannelSplitterNode"/>.
3334
/// </remarks>
3435
[JsonPropertyName("numberOfInputs")]

tests/IntegrationTests/AudioNodeTests/ChannelSplitterNodeTest.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using KristofferStrube.Blazor.WebIDL.Exceptions;
1+
using FluentAssertions;
2+
using KristofferStrube.Blazor.WebIDL.Exceptions;
23
using Microsoft.JSInterop;
34

45
namespace IntegrationTests.AudioNodeTests;
@@ -18,4 +19,30 @@ public override async Task<ChannelSplitterNode> CreateAsync(IJSRuntime jSRuntime
1819
{
1920
[ChannelInterpretation.Speakers] = typeof(InvalidStateErrorException),
2021
};
22+
23+
[Test]
24+
public async Task CreateAsync_WithNoOptions_DefaultsTo6Outputs()
25+
{
26+
// Arrange
27+
await using ChannelSplitterNode node = await ChannelSplitterNode.CreateAsync(JSRuntime, AudioContext);
28+
29+
// Act
30+
ulong numberOfOutputs = await node.GetNumberOfOutputsAsync();
31+
32+
// Assert
33+
_ = numberOfOutputs.Should().Be(6);
34+
}
35+
36+
[Test]
37+
public async Task CreateAsync_WithEmptyOptions_DefaultsTo6Outputs()
38+
{
39+
// Arrange
40+
await using ChannelSplitterNode node = await ChannelSplitterNode.CreateAsync(JSRuntime, AudioContext, new());
41+
42+
// Act
43+
ulong numberOfOutputs = await node.GetNumberOfOutputsAsync();
44+
45+
// Assert
46+
_ = numberOfOutputs.Should().Be(6);
47+
}
2148
}

0 commit comments

Comments
 (0)