public void TestPullables() { Prop.ForAll <string[]>(strings => { var sent = new List <string>(strings); var received = new List <string>(); PullableSource <string> .Sends(sent) .ForEach(output => received.Add(output)); return(sent.SequenceEqual(received)); }).QuickCheckThrowOnFailure(); }
public void TestPullables() { Prop.ForAll <int[]>(numbers => { var sent = new List <int>(numbers); var received = new List <int>(); var expected = new List <int>(numbers).Select(number => number * 2); PullableSource <int> .Sends(sent) .Map(number => number * 2) .AssertSink(output => { received.Add(output); return(true); }, () => { }, () => Assert.Fail("Should not error out!")); return(expected.SequenceEqual(received)); }).QuickCheckThrowOnFailure(); }
public void TestPullables() { Prop.ForAll <int[]>(numbers => { var sent = new List <int>(numbers); var received = new List <int>(); var expected = new List <int>(numbers).Sum(); PullableSource <int> .Sends(sent) .Scan((acc, number) => acc + number, 0) .AssertSink(output => { received.Add(output); return(true); }, () => { }, () => Assert.Fail("Should not error out!")); return(sent.Count == 0 || expected == received.Last()); }).QuickCheckThrowOnFailure(); }
public void TestPullables() { var random = new Random(); Prop.ForAll <int[]>(numbers => { var skip = random.Next(numbers.Length); var sent = new List <int>(numbers); var received = new List <int>(); var expected = new List <int>(numbers).Skip(skip); PullableSource <int> .Sends(sent) .Skip(skip) .AssertSink(output => { received.Add(output); return(true); }, () => { }, () => Assert.Fail("Should not error out!")); return(expected.SequenceEqual(received)); }).QuickCheckThrowOnFailure(); }