public void Should_get_metric_path_and_root_path() { Assert.Equal("/", MetricMenu.GetMetricRootPath(type1)); Assert.Equal("/Summary", MetricMenu.GetMetricPath(type1)); Assert.Equal("/", MetricMenu.GetMetricRootPath(type2)); Assert.Equal("/Files", MetricMenu.GetMetricPath(type2)); Assert.Equal("/Charts/LOC", MetricMenu.GetMetricRootPath(type3)); Assert.Equal("/Charts/LOC/Summary", MetricMenu.GetMetricPath(type3)); }
private void RegisterMetricsAndMenusForThem(ContainerBuilder builder) { var metrics = Assembly.GetExecutingAssembly().GetTypes() .Where(t => t.IsClass && !t.IsAbstract && t.IsAssignableTo <IMetric>()) .ToArray(); foreach (var metric in metrics) { var metricPath = MetricMenu.GetMetricPath(metric); builder.RegisterType(metric) .Keyed <IMetric>(metricPath); } var menus = MetricMenu.GetLinkedMetricMenu(metrics); foreach (var m in menus) { builder.RegisterInstance(m.Value) .Keyed <List <MetricMenu.MetricMenuItem> >(m.Key); } }