Listings: Mutation testing in .NET with Stryker uit SDN Magazine #145

Listing 1:

namespace Demo
{
      public class DemoCode
      {
    	public int AddNumbers(int v1, int v2)
    	{
        	    return v1 + v2;
    	}
      }
 
      [TestClass]
      public class DemoTest
      {
    	[TestMethod]
    	public void MyTestMethod()
    	{
        	    // Arrange
        	    var sut = new DemoCode(); 

        	    // Act
        	    int result = sut.AddNumbers(1, 1); 

        	     //Assert
        	    Assert.AreEqual(result, result);
    	}
       }
}

 

 

Listing 2:

public class DemoCode
{
    	public int AddNumbers(int v1, int v2)
    	{
        	    return v1 - v2;
    	}
}