This file contains hidden or 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
public void EvilTest() | |
{ | |
Console.WriteLine("All is well."); | |
var blackHole = new StringWriter(); | |
Console.SetOut(blackHole); | |
Console.WriteLine("Muwahahaha!"); | |
} |
This file contains hidden or 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
public class ExecuteCases : InstanceBehavior | |
{ | |
public void Execute(Fixture fixture) | |
{ | |
foreach (var @case in fixture.Cases) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
try |
This file contains hidden or 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
static Listener CreateListener() | |
{ | |
var runningUnderTeamCity = Environment.GetEnvironmentVariable("TEAMCITY_PROJECT_NAME") != null; | |
if (runningUnderTeamCity) | |
return new TeamCityListener(); | |
return new ConsoleListener(); | |
} |
This file contains hidden or 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
static void Message(string format, params string[] args) | |
{ | |
var encodedArgs = args.Select(Encode).Cast<object>().ToArray(); | |
Console.WriteLine("##teamcity["+format+"]", encodedArgs); | |
} | |
static string Encode(string value) | |
{ | |
var builder = new StringBuilder(); | |
This file contains hidden or 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
public interface Listener | |
{ | |
void AssemblyStarted(Assembly assembly); | |
void CasePassed(PassResult result); | |
void CaseFailed(FailResult result); | |
void AssemblyCompleted(Assembly assembly, AssemblyResult result); | |
} |
This file contains hidden or 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
##teamcity[testStarted name='CalculatorTests.ShouldAdd'] | |
##teamcity[testStdOut name='CalculatorTests.ShouldAdd' out='2+2 should equal 4'] | |
##teamcity[testFinished name='CalculatorTests.ShouldAdd' duration='15'] | |
##teamcity[testStarted name='CalculatorTests.ShouldSubtract'] | |
##teamcity[testStdOut name='CalculatorTests.ShouldSubtract' out='4-2 should equal 2'] | |
##teamcity[testFailed name='CalculatorTests.ShouldSubtract' details='Assert.AreEqual() Failure|r|nExpected: 2|r|nActual: 123|r|n at CalculatorTests.ShouldSubtract() in c:\path\to\CalculatorTests.cs:Line 38'] | |
##teamcity[testFinished name='CalculatorTests.ShouldAdd' duration='15'] |
This file contains hidden or 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
##teamcity[messageName key='value' otherKey='otherValue'] |
This file contains hidden or 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
TestWithNoParameters | |
TestWithInterestingParameter | |
Person: Arthur Vandelay, born on 1/1/1980 12:00:00 AM. | |
TestWithInterestingParameter | |
Person: Kel Varnsen, born on 1/1/1978 12:00:00 AM. | |
TestWithInterestingParameter | |
Person: Martin Van Nostrand, born on 1/1/1995 12:00:00 AM. |
This file contains hidden or 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
public class CustomConvention : Convention | |
{ | |
public CustomConvention() | |
{ | |
Classes | |
.NameEndsWith("Tests"); | |
Methods | |
.Where(method => method.IsVoid()); |
This file contains hidden or 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
Parameters(method => | |
{ | |
//Attempt to find a perfect matching source for N calls. | |
var parameters = method.GetParameters(); | |
if (parameters.Length == 1) | |
return FindInputs(method.ReflectedType, parameters.Single().ParameterType); | |
//No matching source method, so call it once with with zero parameters. | |
return new[] { new object[] {} }; |