コード例 #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);
        }