public void EnsureThatFetchingLessItemsWorks()
 {
     var log = new RollingLog(20);
     AddEightItemsToLog(log);
     LogEntry[] logEntries = log.GetEntries(null, 3);
     Assert.That(logEntries.Count(), Is.EqualTo(3));
     Assert.That(logEntries[0].Type, Is.EqualTo(LogEntryType.ActivityStart));
     Assert.That(logEntries[2].Type, Is.EqualTo(LogEntryType.Warning));
 }
 public void EnsureThatFetchingAfterOverflowIsCorrect()
 {
     var log = new RollingLog(5);
     AddEightItemsToLog(log);
     LogEntry[] logEntries = log.GetEntries(null, 3);
     Assert.That(logEntries.Count(), Is.EqualTo(3));
     Assert.That(logEntries[0].Type, Is.EqualTo(LogEntryType.Warning));
     Assert.That(logEntries[1].Type, Is.EqualTo(LogEntryType.Error));
 }
 private static void AddEightItemsToLog(RollingLog log)
 {
     log.BeginActivity("Test execution started");
     log.Info("First step is performed");
     log.Warning("First step warning");
     log.Warning("First step warning with exception", new NotSupportedException("The action is not supported"));
     log.Error("Something bad happenned");
     log.Error("Something bad happenned with exception", new NotSupportedException("The action was never and will be not supported"));
     log.Success("And finally success somewhere");
     log.EndActivity("First step is finished");
 }
        public void EnsureThatFetchingNextItemsAfterOverflowIsCorrect()
        {
            var log = new RollingLog(6);
            AddEightItemsToLog(log);
            LogEntry[] logEntries = log.GetEntries(null, 3);
            Assert.That(logEntries.Count(), Is.EqualTo(3));

            logEntries = log.GetEntries(logEntries[2].Id, 3);
            Assert.That(logEntries.Count(), Is.EqualTo(3));
            Assert.That(logEntries[1].Type, Is.EqualTo(LogEntryType.Success));
        }
        public void EnsureNextItemsAreReturnedCorrectly()
        {
            var log = new RollingLog(20);
            AddEightItemsToLog(log);
            LogEntry[] logEntries = log.GetEntries(null, 3);
            Assert.That(logEntries.Count(), Is.EqualTo(3));

            logEntries = log.GetEntries(logEntries[2].Id, 3);
            Assert.That(logEntries.Count(), Is.EqualTo(3));
            Assert.That(logEntries[0].Type, Is.EqualTo(LogEntryType.Warning));
            Assert.That(logEntries[1].Type, Is.EqualTo(LogEntryType.Error));
        }
 /// <summary>
 /// Initializes a new instance of dashboard service
 /// </summary>
 /// <param name="agents">The <see cref="AgentsCollection">connections tracker</see> for the server</param>
 /// <param name="log">The log to display for requests</param>
 /// <param name="serverConfiguration">The server configuration.</param>
 /// <param name="connectionProvider">The connection provider.</param>
 public DashboardService(AgentsCollection agents, 
     RollingLog log,
     ServerConfiguration serverConfiguration,
     IConnectionProvider connectionProvider)
 {
     this.agents = agents;
     this.log = log;
     this.serverConfiguration = serverConfiguration;
     this.connectionProvider = connectionProvider;
 }
 public OptionalParamsInConstructor(ConsoleLog consoleLog, RollingLog rollingLog = null)
 {
     ConsoleLog = consoleLog;
     RollingLog = rollingLog;
 }
 public void EnsureThatLogIsSaved()
 {
     var log = new RollingLog(20);
     AddEightItemsToLog(log);
     Assert.That(log.GetEntries(null, Int32.MaxValue).Count(), Is.EqualTo(8));
 }