Setting up a simple testing project with C#

This page summarizes the projects mentioned and recommended in the original post on dev.to

InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video.
Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
getstream.io
featured
  1. Moq

    Discontinued Repo for managing Moq 4.x [Moved to: https://github.com/moq/moq]

    In terms of mocking there are several frameworks you can use, but I've mainly relied on Moq and NSubstitute. Within this demo, I'm going to use NSubstitute as I've found it a little easier to use.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. 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.

    The next test to talk about, is that if this was a bank, we would have multiple customers, who can hold multiple accounts that we need to calculate the interest for. You could manually construct these objects if you want, but I'm going to use a package called AutoFixture to make life easier.

  4. coverlet

    Cross platform code coverage for .NET

    You might have noticed when you were looking in NuGet, there was a package called coverlet installed into the project:

  5. xUnit

    xUnit.net is a free, open source, community-focused unit testing tool for .NET.

    At this point you're going to see a familiar screen asking you to select a project. Here we're looking for a test project. By default, Visual Studio gives you access to 3 different testing frameworks based on your choice of project. These are MSTest, XUnit and NUnit. Ultimately, all 3 of these testing accomplish the same thing, and I've worked with all of them at various points in my career. The difference is mainly in exact syntax and documentation. Although, it's generally considered that MSTest is a little "older" than NUnit or XUnit, so I tend to see it less now. For the purposes of this demo, I'm going to go with NUnit:

  6. ReportGenerator

    ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.

    In order to view the results in a human-readable format, you will need to install the NuGet package Report Generator. Unfortunately, this isn't quite as easy as just installing the NuGet package.

  7. NUnit

    NUnit Framework

    At this point you're going to see a familiar screen asking you to select a project. Here we're looking for a test project. By default, Visual Studio gives you access to 3 different testing frameworks based on your choice of project. These are MSTest, XUnit and NUnit. Ultimately, all 3 of these testing accomplish the same thing, and I've worked with all of them at various points in my career. The difference is mainly in exact syntax and documentation. Although, it's generally considered that MSTest is a little "older" than NUnit or XUnit, so I tend to see it less now. For the purposes of this demo, I'm going to go with NUnit:

  8. NSubstitute

    A friendly substitute for .NET mocking libraries.

    In terms of mocking there are several frameworks you can use, but I've mainly relied on Moq and NSubstitute. Within this demo, I'm going to use NSubstitute as I've found it a little easier to use.

  9. Stream

    Stream - Scalable APIs for Chat, Feeds, Moderation, & Video. Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.

    Stream logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Beginner's Guide to Test Coverage with NUnit, Coverlet, and ReportGenerator

    3 projects | dev.to | 17 Jun 2024
  • I need a C# crash course for experienced developers

    6 projects | /r/learncsharp | 21 Oct 2022
  • Some useful Libraries for .NET projects

    6 projects | dev.to | 2 Oct 2021
  • .NET Core Code Coverage

    3 projects | dev.to | 7 Mar 2021
  • Cell CMS - Criando testes de maneira prática

    6 projects | dev.to | 31 Jan 2021

Did you know that C# is
the 10th most popular programming language
based on number of references?