예제 #1
0
        public void DisposeBehavior_Property_Should_Be_The_Value_Passed_To_Constructor()
        {
            var expected = StreamReaderEnumeratorDisposeBehavior.CloseStreamReader;

            var sut = new StreamReaderEnumerator(this.testBag.StreamReader, expected);

            sut.DisposeBehavior.Should().Be(expected);
        }
예제 #2
0
        public void First_Call_To_MoveNext_Should_Make_Current_Property_Have_First_Line_Of_Expected_String()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.MoveNext();

            sut.Current.Should().Be(this.testBag.Line1);
        }
예제 #3
0
        public void Reset_Should_Put_Stream_Reader_Back_At_Start()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.MoveNext();
            sut.Reset();

            sut.BaseStreamReader.BaseStream.Position.Should().Be(0);
        }
예제 #4
0
        public void Second_Call_To_MoveNext_Should_Return_True()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.MoveNext();

            sut.MoveNext().Should().BeTrue();
        }
예제 #5
0
        public void BaseStreamReader_Property_Should_Have_Same_Instance_Passed_To_Constructor()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.BaseStreamReader.Should().Be(this.testBag.StreamReader);
        }
예제 #6
0
        public void When_Initialized_Generic_Current_Property_Should_Be_Null()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.Current.Should().BeNull();
        }
예제 #7
0
        public void When_Disposed_With_Default_DisposeBehavior_Should_Not_Close_StreamReader()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.Dispose();

            this.testBag.StreamReader.Read();
        }
예제 #8
0
        public void Third_Call_To_MoveNext_Should_Return_False()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.MoveNext();
            sut.MoveNext();

            sut.MoveNext().Should().BeFalse();
        }
예제 #9
0
        public void Third_Call_To_MoveNext_Should_Make_Current_Property_Have_Second_Line_Of_Expected_String_And_Return_False()
        {
            var sut = new StreamReaderEnumerator(this.testBag.StreamReader);

            sut.MoveNext();
            sut.MoveNext();
            sut.MoveNext().Should().BeFalse();

            sut.Current.Should().Be(this.testBag.Line2);
        }