public void NotShrinking() { Func <bool> runFunc = () => { if (theInt == 42) { return(true); // means failure } return(false); }; theInt = 42; var shrinkStrat = new ShrinkingStrategy() .Add(Manipulate.This(this) .Change(e => e.theInt, -1) .Change(e => e.theInt, 0) .Change(e => e.theInt, 1)); shrinkStrat.Shrink(runFunc); Assert.False(shrinkStrat.Shrunk()); }
public override void Shrink(Func <bool> runFunc) { shrunk = new ShrinkingStrategy() .Add(Manipulate.This(this) .Change(e => e.input, -1) .Change(e => e.input, 0) .Change(e => e.input, 1)); shrunk.Shrink(runFunc); }
public void SimpleShrinking() { Func <bool> runFunc = () => true; // means fail always theInt = 42; var shrinkStrat = new ShrinkingStrategy() .Add(Manipulate.This(this) .Change(e => e.theInt, -1) .Change(e => e.theInt, 0) .Change(e => e.theInt, 1)); shrinkStrat.Shrink(runFunc); Assert.True(shrinkStrat.Shrunk()); }
public override void Shrink(Func <bool> runFunc) { shrinkA = new ShrinkingStrategy() .Add(Manipulate.This(this) .Change(e => e.a, -1) .Change(e => e.a, 0) .Change(e => e.a, 1)); shrinkB = new ShrinkingStrategy() .Add(Manipulate.This(this) .Change(e => e.b, -1) .Change(e => e.b, 0) .Change(e => e.b, 1)); shrinkA.Shrink(runFunc); shrinkB.Shrink(runFunc); }