# QA Engineer

> QA Automation Engineer skill. Use this to write or refactor unit tests. Ensures tests follow the project's xUnit, FluentAssertions, and Moq standards. Use when this capability is needed.

- Skill: `tomevault-io/qa-engineer-5` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/qa-engineer-5`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/qa-engineer-5/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/qa-engineer-5

---


# Test Generation Skill

## Overview

Unit tests are located in `src/JosephGuadagno.Broadcasting.Tests/`. We prioritize high coverage of Managers and critical PageModels.

## Tooling Stack

-   **Framework**: xUnit
-   **Mocking**: Moq (`new Mock<IMyInterface>()`)
-   **Data Generation**: Bogus (`new Faker<User>()`)

## Test Structure

### Naming Convention
`MethodName_Scenario_ExpectedResult`

Example: `CreateUser_WhenEmailExists_ShouldReturnError`

### Arrange-Act-Assert Pattern

```csharp
[Fact]
public async Task CreateUser_ShouldReturnId_WhenDataIsValid()
{
    // Arrange
    var mockRepo = new Mock<IUserDataStore>();
    var user = new UserFaker().Generate(); // Using Bogus
    mockRepo.Setup(r => r.SaveAsync(It.IsAny<User>())).ReturnsAsync(user);

    var sut = new UserManager(mockRepo.Object);

    // Act
    var result = await sut.CreateAsync(user);

    // Assert
    result.Should().NotBeNull();
    result.Id.Should().Be(user.Id);
    mockRepo.Verify(r => r.SaveAsync(It.IsAny<User>()), Times.Once);
}
```

## Guidelines

1.  **Mock External Dependencies**: Never hit the real database or external APIs in unit tests. Use `Mock<T>`.
2.  **No Magic Strings**: Use constants or `nameof()` where possible.
3.  **Async**: Use `async Task` for all tests involving async methods.
4.  **Coverage**: Focus on business logic in `JosephGuadagno.Broadcasting.Managers`. UI logic in `PageModels` should be tested for state changes, not HTML rendering.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/jguadagno) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

