Unit Test (edit)

  • AutoFixture
    • Add new object with a factory method
    • Add new object with the builder API
  • AutoFixture with xUnit
  • AutoFixture with NUnit
  • Respawn
    • SQL Server
    • PostgreSQL
    • MySQL/MariaDB
    • Oracle
  • Influence Test Generation
[Fact]
public void Should_create_a_customer()
{
    // With a factory method
    var customer = CustomerHelpers.CreateCustomer();
// With the builder API var customer = new CustomerBuilder().Build(); // act: create customer // assert: verify customer has been created }

How to test your C# Web API - Tim Deschryver

Why I stopped worrying about test setups by using AutoFixture - Tim Deschryver

Tutorial: Getting Started with xUnit and AutoFixture | Sean Spaniel (wordpress.com)

  • xUnit
  • AutoFixture
  • Respawn
    • Respawn.Postgres
  • Influence Test Generation

Jimmy Bogard explains why you should avoid in-memory databases for your tests in his recent blog post "Avoid In-Memory Databases for Tests"

To reseed my databases I'm using the Respawn package

jbogard/Respawn: Intelligent database cleaner for integration tests (github.com)

Builds upon Respawn and provides enhanced performance for Postgres databases. Respawn is an intelligent database cleaner for integration tests.

sandord/Respawn.Postgres: Builds upon Respawn and provides enhanced performance for Postgres databases. Respawn is an intelligent database cleaner for integration tests. (github.com)

Write maintainable unit tests, faster. AutoFixture makes it easier for developers to do Test-Driven Development by automating non-relevant Test Fixture Setup, allowing the Test Developer to focus on the essentials of each test case.

AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.

AutoFixture/AutoFixture: AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data. (github.com)

Automagically optimize your images with Squoosh - Tim Deschryver