Skip to content

unit tests

Diego Giacomelli edited this page Nov 3, 2018 · 3 revisions

Introduction

For GeneticSharp we expected 100% of code coverage.

Coverage Status

You can see the current code quality status of the project on our Sonar Dashboard.

Organization

Each class should have a corresponding unit test class, for example:

GeneticSharp.Domain.Chromosomes.Gene class will have a unit test class called GeneticSharp.Domain.UnitTests.Chromosomes.GeneTest.

Naming

We use Roy Osherove's naming strategy, it's the following:

UnitOfWork_StateUnderTest_ExpectedBehavior

Bellow some real samples from GeneticSharp's unit tests:

[Test]
public void Constructor_NullSelection_Exception()
[Test]
public void Start_ParallelManyGenerations_Optimization()
[Test]
public void Start_ParallelManySlowFitness_Timeout()
[Test]
public void ReplaceGene_ValidIndex_Replaced()
You can’t perform that action at this time.