---
# System prepended metadata

title: Cloning Capability Web API - Test libraries

---

# Cloning Capability Web API - Test libraries 

**Test framework: xUnit**
The current recommended framework is NUnit, but xUnit is considered to be a more modern and extensbile implementation, so I decided to try it out

**Mock libary: NSubstitute**
Recommended currently. Works well.

**Assertions libary: FluentAssertions**
One of the recommended libraries. Nice syntax, allows for more powerful assertions like object value equivalence.

**Test data builder: AutoBogus**
Allows to easily construct input objects of test by autofilling values that is not relevant for the test. Based on Bogus library that provides generation for many specific types of data like names, phone numbers etc.   
*Open question:* Because Bogus generates random data we need to set the random seed properly for all tests to make them deterministic. 

**Web service hosting: WebApplicationFactory**
A way to host a ASP.NET application in a test context that allows to test a web service as a integrated entity including ASP.NET pipeline and dependecy injections.

**Test database: Sqlite**
Simple SQL in-memory database. Not fully equivalent to the databse we use in production (PostgreSQL). 

**Additional assertions: FluentAssertions.Web**
Extensions for FluentAssertions with additional assertions around Http responses. Allows to use the same _Should_ syntax and also provides a better output when assertion fails (e.g. includes HTTP response body).
