public ServiceStatus(DateTime lastBuilt, DateTime lastUpdated, IReadOnlyComponent serviceRootComponent, IEnumerable <Event> events) { LastBuilt = lastBuilt; LastUpdated = lastUpdated; ServiceRootComponent = serviceRootComponent; Events = events; }
public ReadOnlyComponentWrapper(IReadOnlyComponent component, IReadOnlyComponent parent) { _component = component; _parent = parent; SubComponents = _component.SubComponents?.Select(s => new ReadOnlyComponentWrapper(s, this)).ToList() ?? Enumerable.Empty <IReadOnlyComponent>(); }
public static void AssertComponent(IReadOnlyComponent expected, IReadOnlyComponent actual) { AssertFieldEqual(expected, actual, i => i.Description); AssertFieldEqual(expected, actual, i => i.Name); AssertFieldEqual(expected, actual, i => i.Status); AssertFieldEqual(expected, actual, i => i.SubComponents, AssertComponent); AssertFieldEqual(expected, actual, i => i.Path); }
/// <summary> /// Returns a string that can be used as the value of an HTML id attribute for <paramref name="component"/>. /// See <see cref="StringExtensions.ToHtmlSafeId(string)"/>. /// </summary> public static string ToHtmlSafePathId(this IReadOnlyComponent component) { if (component == null) { throw new ArgumentNullException(nameof(component)); } return(component.Path.ToHtmlSafeId()); }
/// <summary> /// Recursively iterates through the subcomponents of <paramref name="component"/> and returns all components found, including <paramref name="component"/> itself. /// </summary> public static IEnumerable <IReadOnlyComponent> GetAllComponents(this IReadOnlyComponent component) { if (component == null) { yield break; } yield return(component); foreach (var subcomponent in component.SubComponents.SelectMany(s => s.GetAllComponents())) { yield return(subcomponent); } }
public ServiceStatus(IReadOnlyComponent serviceRootComponent, IEnumerable <Event> events) : this(DateTime.Now, serviceRootComponent, events) { }