Esempio n. 1
0
        public void Registry_should_register_push_monitor_type_during_construction_and_return_it()
        {
            var registry = new HealthMonitorTypeRegistry(_repository.Object);

            _repository.Verify(r => r.SaveMonitorType(HealthMonitorTypeRegistry.PushMonitorType), Times.Once);
            Assert.Equal(new[] { "push" }, registry.GetMonitorTypes().ToArray());
        }
Esempio n. 2
0
        public void GetMonitorTypes_should_return_all_currently_registered_monitors()
        {
            _repository.Setup(r => r.LoadMonitorTypes()).Returns(new[] { "abc", "def" });
            var registry = new HealthMonitorTypeRegistry(_repository.Object);

            registry.RegisterMonitorType("ghi");
            Assert.Equal(new[] { "abc", "def", "ghi" }, registry.GetMonitorTypes().OrderBy(t => t));
        }
Esempio n. 3
0
        public void RegisterMonitorType_should_register_new_types_and_ignore_currently_existing_ones()
        {
            _repository.Setup(r => r.LoadMonitorTypes()).Returns(new[] { "abc" });

            var registry = new HealthMonitorTypeRegistry(_repository.Object);

            Assert.Equal(new[] { "abc" }, registry.GetMonitorTypes().OrderBy(t => t));

            registry.RegisterMonitorType("def");
            registry.RegisterMonitorType("abc");
            registry.RegisterMonitorType("ghi");
            Assert.Equal(new[] { "abc", "def", "ghi" }, registry.GetMonitorTypes().OrderBy(t => t));
        }