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
1. uses a ContextFixture (which requires Disposal) | |
2. keeps all Context/ContextFixture+Do+Assert/Observation in a single Test Method at all costs -- lambdas get very yucky the minute you factor calls to any of these into test methods | |
3. The TheoryDataProvider junk at the end is also applicable to xUnit [Theory] stuff (and you use the same [ClassData] and friends as one uses for other xunit.net stuff and just removes some cruft from writing up test cases) | |
4. uses sut/result/exception standard names | |
5. This is a sample and has stuff that doesnt scale up that I wouldnt do. e.g. dont use Conditional Logic in tests with care - something as simple as a should succeed / should fail set of cases should generally be two separate Thesis methods | |
Go look in bitbucket - there's a good set of tests that serve as a better set of samples. | |
This snippet will self destruct when someone tells me that the acceptance tests and samples in Johannes' fork are clearer and more complete |
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
public class Frozen<T> | |
{ | |
readonly T _value; | |
private Frozen( T t ) | |
{ | |
_value = t; | |
} | |
public Frozen( Fixture fixture ) |
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
namespace Ploeh.AutoFixture.Forked | |
{ | |
class HackedDisposableTrackingCustomization : ICustomization, IDisposable | |
{ | |
private readonly DisposableTrackingBehavior behavior; | |
public HackedDisposableTrackingCustomization() | |
{ | |
this.behavior = new DisposableTrackingBehavior(); | |
} |
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
static class SutContext | |
{ | |
public static SutContext<T> Create<T>() | |
{ | |
T sut; | |
return Create<T>( out sut ); | |
} | |
public static SutContext<T> Create<T>( out T sut ) | |
{ |
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
function Get-ClipboardText { | |
$command = { | |
add-type -an system.windows.forms | |
[System.Windows.Forms.Clipboard]::GetText() | |
} | |
powershell -sta -noprofile -command $command | |
} | |
function Get-GrepWinClipboardFiles() { | |
get-ClipboardText | ConvertFrom-Csv -del "`t" | %{ $_.Path+"\"+$_.Name } |
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
[Theory] | |
[ClassAutoData( typeof( XProvider ) )] | |
public static void Scenario( X x, string y ) | |
{ | |
Console.WriteLine( x + "," + y ); | |
} | |
public class ClassAutoDataAttribute : CompositeDataAttribute | |
{ | |
public ClassAutoDataAttribute( Type @class ) |
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
namespace Ploeh.AutoFixture | |
{ | |
using Kernel; | |
using System; | |
public class PostProcessWhereIsACustomization<T> : ICustomization | |
where T : class | |
{ | |
readonly PostProcessSpecimensBehavior _behavior; |
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
static class Program | |
{ | |
static void Main() | |
{ | |
var x = new { a=0, b=1 }; | |
f( x ); | |
} | |
static void f(dynamic x) | |
{ | |
Console.WriteLine(x.b); |
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
/* | |
output of the row test below | |
describe AClass | |
describe many variations | |
A should equal A | |
C should equal A - [Failed] | |
*/ | |
//top level context to describe class | |
class describe_AClass |
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; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Reflection; | |
using Xunit.Extensions; | |
namespace Prototypes.AutoFixture.Xunit.Extensions | |
{ | |
public class CompositeDataAttribute : DataAttribute |
OlderNewer