示例#1
0
        public void Discovery_should_monitors_that_cannot_be_instantiated()
        {
            var expected = new[] { typeof(HttpMonitor), typeof(HttpJsonMonitor) };

            var monitors = PluginDiscovery <IHealthMonitor> .DiscoverAll(
                typeof(BrokenMonitor).Assembly.Location,
                typeof(HttpMonitor).Assembly.Location);

            CollectionAssert.AreEquivalent(expected, monitors.Select(p => p.GetType()));
        }
示例#2
0
        public void Discovery_should_scan_given_assembly_only_once()
        {
            var expected = new[] { typeof(HttpMonitor), typeof(HttpJsonMonitor) };

            var monitors = PluginDiscovery <IHealthMonitor> .DiscoverAll(
                typeof(HttpMonitor).Assembly.Location,
                typeof(HttpMonitor).Assembly.Location
                );

            CollectionAssert.AreEquivalent(expected, monitors.Select(p => p.GetType()));
        }
示例#3
0
        public void Discovery_should_skip_assemblies_that_cannot_be_loaded()
        {
            var expected = new[] { typeof(HttpMonitor), typeof(HttpJsonMonitor) };


            var monitors = PluginDiscovery <IHealthMonitor> .DiscoverAll(
                "some_inexistent_assembly.dll",
                typeof(HttpMonitor).Assembly.Location);

            CollectionAssert.AreEquivalent(expected, monitors.Select(p => p.GetType()));
        }
示例#4
0
        public void Discovery_should_load_and_instantiate_all_monitors()
        {
            var expected = new[]
            {
                typeof(HttpMonitor),
                typeof(HttpJsonMonitor),
                typeof(TestHealthMonitor),
                typeof(TestHealthMonitor2)
            };


            var monitors = PluginDiscovery <IHealthMonitor> .DiscoverAll(
                typeof(HttpMonitor).Assembly.Location,
                typeof(TestHealthMonitor).Assembly.Location);

            CollectionAssert.AreEquivalent(expected, monitors.Select(p => p.GetType()));
        }