Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Added Moq (most popular .NET mocking library) to the test suite and created example tests demonstrating its usage with networking interfaces.

Changes

  • Added Moq v4.20.72 package reference to Void.Tests.csproj
  • Created NetworkTests.cs with 13 example tests covering:
    • INetworkChannel: async message operations, pause/resume controls, lifecycle
    • INetworkStream: async I/O with buffer management
  • Added project reference to Void.Proxy.Plugins.Common for network testing

Example Usage

[Fact]
public async Task NetworkChannel_ReadMessageAsync_WhenMessageAvailable_ReturnsMessage()
{
    var mockChannel = new Mock<INetworkChannel>();
    var mockMessage = new Mock<INetworkMessage>();

    mockChannel.Setup(c => c.ReadMessageAsync(It.IsAny<CancellationToken>()))
        .ReturnsAsync(mockMessage.Object);

    var message = await mockChannel.Object.ReadMessageAsync();

    Assert.NotNull(message);
    mockChannel.Verify(c => c.ReadMessageAsync(It.IsAny<CancellationToken>()), Times.Once);
}

Tests demonstrate Setup/Verify patterns, async testing, and callback capture for validation.

Original prompt

Add most popular mocking library and add few example networking tests with it


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 14, 2026
Added the most popular .NET mocking library (Moq) and created example networking tests demonstrating its usage with network interfaces.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copilot AI changed the title [WIP] Add popular mocking library and networking test examples test(network): add Moq mocking library with networking test examples Jan 14, 2026
Copilot AI requested a review from caunt January 14, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants