Created
May 27, 2017 15:00
-
-
Save lowenthal-jason/1e337c3ddd663bb05fa4adea02937f1b to your computer and use it in GitHub Desktop.
Example of Evil Pairing (borrowed from https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Prime.Services | |
{ | |
public class PrimeService | |
{ | |
public bool IsPrime(int candidate) | |
{ | |
return candidate != 1; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xunit; | |
using Prime.Services; | |
namespace Prime.UnitTests.Services | |
{ | |
public class PrimeService_IsPrimeShould | |
{ | |
private readonly PrimeService _primeService; | |
public PrimeService_IsPrimeShould() | |
{ | |
_primeService = new PrimeService(); | |
} | |
[Fact] | |
public void ReturnFalseGivenValueOf1() | |
{ | |
var result = _primeService.IsPrime(1); | |
Assert.False(result, $"1 should not be prime"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment