예제 #1
0
        public override void SetUp()
        {
            base.SetUp();

            _metricProviderFactory = new ValueMetricProviderFactory();
            _subsystem = new SystemMonitoringSubsystem(Container);

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
        }
예제 #2
0
        /// <summary>
        ///     Registers the default Alfred <paramref name="container" /> with good default testing
        ///     values.
        /// </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="container" /> </exception>
        /// <param name="container"> The container. </param>
        public static void RegisterDefaultAlfredMappings([NotNull] this IObjectContainer container)
        {
            if (container == null) { throw new ArgumentNullException(nameof(container)); }

            var console = new SimpleConsole(container);
            console.RegisterAsProvidedInstance(typeof(IConsole), container);

            // Register mappings for promised types
            container.Register(typeof(IConsoleEvent), typeof(ConsoleEvent));
            container.Register(typeof(MetricProviderBase), typeof(ValueMetricProvider));

            // We'll want to get at the same factory any time we request a factory for test purposes
            var factory = new ValueMetricProviderFactory();
            factory.RegisterAsProvidedInstance(typeof(IMetricProviderFactory), container);
            factory.RegisterAsProvidedInstance(typeof(ValueMetricProviderFactory), container);
        }