Exemplo n.º 1
0
        public void TestAddEntry2()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hello,", LevelFlags.Info, new DateTime(2017, 4, 29, 14, 56, 0));
            logFile.AddEntry(" World!", LevelFlags.Warning, new DateTime(2017, 4, 29, 14, 56, 2));
            logFile.Count.Should().Be(2);

            var entry1 = logFile.GetEntry(0);

            entry1.Index.Should().Be(0);
            entry1.LogEntryIndex.Should().Be(0);
            entry1.LogLevel.Should().Be(LevelFlags.Info);
            entry1.RawContent.Should().Be("Hello,");
            entry1.Timestamp.Should().Be(new DateTime(2017, 4, 29, 14, 56, 0));

            var entry2 = logFile.GetEntry(1);

            entry2.Index.Should().Be(1);
            entry2.LogEntryIndex.Should().Be(1);
            entry2.LogLevel.Should().Be(LevelFlags.Warning);
            entry2.RawContent.Should().Be(" World!");
            entry2.Timestamp.Should().Be(new DateTime(2017, 4, 29, 14, 56, 2));

            logFile.GetProperty(Core.Properties.StartTimestamp).Should().Be(new DateTime(2017, 4, 29, 14, 56, 0));
            logFile.GetProperty(Core.Properties.Duration).Should().Be(TimeSpan.FromSeconds(2));
        }
Exemplo n.º 2
0
        public void TestClear3()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hi", LevelFlags.Info);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(2);
            logFile.Clear();
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(0);
        }
Exemplo n.º 3
0
        public void TestAddEntry4()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hi", LevelFlags.Info);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(2);
            logFile.AddEntry("Hello, World!", LevelFlags.Info);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(13);
        }
Exemplo n.º 4
0
        public void TestAddEntry1()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hello, World!", LevelFlags.Info);
            logFile.Count.Should().Be(1);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(13);
            logFile.GetProperty(Core.Properties.StartTimestamp).Should().BeNull();

            var entry = logFile.GetEntry(0);

            entry.ElapsedTime.Should().BeNull("because this entry doesn't have any timestamp and thus its elapsed time must be null");
        }
Exemplo n.º 5
0
        public void TestClear4()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hi", LevelFlags.Info);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(2);

            logFile.AddListener(_listener.Object, TimeSpan.Zero, 1);
            logFile.Clear();
            _modifications.Should().EndWith(LogSourceModification.Reset());
        }
Exemplo n.º 6
0
        public void TestConstruction1()
        {
            var logFile = new InMemoryLogSource();

            logFile.Columns.Should().Equal(Core.Columns.Minimum);
            logFile.GetProperty(Core.Properties.Size).Should().Be(Size.Zero);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(0);
            logFile.GetProperty(Core.Properties.LastModified).Should().BeNull();
            logFile.GetProperty(Core.Properties.StartTimestamp).Should().BeNull();
            logFile.GetProperty(Core.Properties.EndTimestamp).Should().BeNull();
            logFile.GetProperty(Core.Properties.Duration).Should().BeNull();
            logFile.GetProperty(Core.Properties.EmptyReason).Should().Be(null);
            logFile.GetProperty(Core.Properties.PercentageProcessed).Should().Be(Percentage.HundredPercent);
            logFile.Count.Should().Be(0);
        }
Exemplo n.º 7
0
        public void TestClear1()
        {
            var logFile = new InMemoryLogSource();

            logFile.Clear();
            logFile.GetProperty(Core.Properties.Size).Should().Be(Size.Zero);
            logFile.GetProperty(TextProperties.MaxCharactersInLine).Should().Be(0);
            logFile.GetProperty(Core.Properties.LastModified).Should().BeNull();
            logFile.GetProperty(Core.Properties.StartTimestamp).Should().BeNull();
            logFile.GetProperty(Core.Properties.EndTimestamp).Should().BeNull();
            logFile.GetProperty(Core.Properties.Duration).Should().BeNull();
            logFile.GetProperty(Core.Properties.EmptyReason).Should().Be(null);
            logFile.Count.Should().Be(0);
        }