public void Test_2() { var iterator = new CombinationIterator("abc", 2); iterator.Next().Should().Be("ab"); iterator.HasNext().Should().BeTrue(); iterator.Next().Should().Be("ac"); iterator.HasNext().Should().BeTrue(); iterator.Next().Should().Be("bc"); iterator.HasNext().Should().BeFalse(); }
public void TestMethod1() { var iterator = new CombinationIterator("chp", 1); var k1 = iterator.HasNext(); var k2 = iterator.Next(); // returns "ab" var k3 = iterator.HasNext(); // returns "ab" var k4 = iterator.HasNext(); // returns true var k5 = iterator.Next(); // returns true var k6 = iterator.Next(); // returns "ac" var k7 = iterator.HasNext(); // returns "bc" var k8 = iterator.HasNext(); // returns false var k9 = iterator.HasNext(); // returns false }