public void Examples(string value, int k, string expectedShrinksDelimited) { var func = ShrinkFunc.OtherCombinations <char>(k); var shrinks = func(value.ToList()).Select(chars => new string(chars.ToArray())); shrinks.Should().BeEquivalentTo(expectedShrinksDelimited.Split(",")); }
public IGen <Test> IfKIsOne_ItProducesAListOfEachSingleElement() => from list in DomainGen.AnyList().WithCountGreaterThanEqual(2) select Property.ForThese(() => { var func = ShrinkFunc.OtherCombinations <object>(1); var shrinks = func(list.ToList()); shrinks.Should().HaveCount(list.Count); shrinks.SelectMany(x => x).Should().BeEquivalentTo(list); });
public IGen <Test> IfListCountIsGreaterThanK_ItWillShrink() => from k in Gen.Int32().Between(1, 20) from list in DomainGen.AnyList().WithCountGreaterThan(k) select Property.ForThese(() => { var func = ShrinkFunc.OtherCombinations <object>(k); var shrinks = func(list.ToList()); shrinks.Should().NotBeEmpty(); });