public void Create(string name, string server, Exception error) { IQueueInformation test = new QueueInformationError(name, server, error); Assert.Equal(name, test.Name); Assert.Equal(server, test.Server); Assert.Equal(DateTime.MinValue, test.CurentDateTime); Assert.Equal(string.Empty, test.DateTimeProvider); Assert.Equal(1, test.Data.Count()); var systemEntries = test.Data.ToList(); Assert.Contains(error.ToString(), systemEntries[0].Value); Assert.Contains("Error", systemEntries[0].Name); }
/// <summary> /// Initializes a new instance of the <see cref="QueueStatus"/> class. /// </summary> /// <param name="providers">The providers.</param> public QueueStatus(IEnumerable<IQueueStatusProvider> providers) { var statues = new ConcurrentBag<IQueueInformation>(); Parallel.ForEach(providers, provider => { IQueueInformation current; try { current = provider.Current; } catch (Exception error) { current = new QueueInformationError(provider.Name, provider.Server, error); } if (current != null) { statues.Add(current); } }); Queues = statues.ToList(); }
/// <summary> /// Initializes a new instance of the <see cref="QueueStatus"/> class. /// </summary> /// <param name="providers">The providers.</param> public QueueStatus(IEnumerable <IQueueStatusProvider> providers) { var statues = new ConcurrentBag <IQueueInformation>(); Parallel.ForEach(providers, provider => { IQueueInformation current; try { current = provider.Current; } catch (Exception error) { current = new QueueInformationError(provider.Name, provider.Server, error); } if (current != null) { statues.Add(current); } }); Queues = statues.ToList(); }