DEV Community

Matheus Rodrigues
Matheus Rodrigues

Posted on • Originally published at matheus.ro on

SUT Factory

SUT factory may be a fancy name to what is basically a utility method, used to create an instance of the system under test. The main point of a SUT Factory is to reduce code duplication and improve maintainability of your unit tests suite.

I’ll show you a quick example of how can you implement this type of utility method.

Imagine a test like this one:

[TestMethod]
public void TestUsingConstructor()
{
    //Arrange
    MySUT sut = new MySUT();

    //Act
    //...Exercise the sut

    //Assert
    //...Verifying the results
}

Continue Reading...

Top comments (0)