Esempio n. 1
0
        public void coroutines_can_be_iterated()
        {
            var sut = new SomeClass();

            sut.Step.Should().Be(0);

            var iterator = sut.AnotherCoroutine().GetEnumerator();

            iterator.MoveNext().Should().Be(true);
            iterator.Current.Should().Be("foo");
            sut.Step.Should().Be(1);

            iterator.MoveNext().Should().Be(true);
            iterator.Current.Should().Be("bar");
            sut.Step.Should().Be(2);

            iterator.MoveNext().Should().Be(true);
            iterator.Current.Should().Be("baz");
            sut.Step.Should().Be(3);

            iterator.MoveNext().Should().Be(false);
        }