Пример #1
0
        public void TestFillInvalidLength()
        {
            var buffer = new LogBufferList(Core.Columns.LineNumber);

            buffer.Resize(10);
            buffer.Fill(Core.Columns.LineNumber, 42, 0, 10);
            new Action(() => buffer.Fill(Core.Columns.LineNumber, 9001, 0, 11))
            .Should().Throw <ArgumentException>();

            for (int i = 0; i < 10; ++i)
            {
                buffer[i].LineNumber.Should().Be(42, "because nothing may have been overwritten");
            }
        }
Пример #2
0
        public void TestFill_NullColumn()
        {
            var buffer = new LogBufferList(Core.Columns.LineNumber);

            buffer.Resize(10);
            new Action(() => buffer.Fill(null, 42, 2, 4)).Should().Throw <ArgumentNullException>();
        }
Пример #3
0
        public void TestFill()
        {
            var buffer = new LogBufferList(Core.Columns.LineNumber);

            buffer.Resize(10);
            buffer.Fill(Core.Columns.LineNumber, 42, 2, 4);
            buffer.Fill(Core.Columns.LineNumber, 1337, 7, 2);

            buffer[0].LineNumber.Should().Be(Core.Columns.LineNumber.DefaultValue);
            buffer[1].LineNumber.Should().Be(Core.Columns.LineNumber.DefaultValue);
            buffer[2].LineNumber.Should().Be(42);
            buffer[3].LineNumber.Should().Be(42);
            buffer[4].LineNumber.Should().Be(42);
            buffer[5].LineNumber.Should().Be(42);
            buffer[6].LineNumber.Should().Be(Core.Columns.LineNumber.DefaultValue);
            buffer[7].LineNumber.Should().Be(1337);
            buffer[8].LineNumber.Should().Be(1337);
            buffer[9].LineNumber.Should().Be(Core.Columns.LineNumber.DefaultValue);
        }