Exemplo n.º 1
0
        public void GetLogic_InvalidMetric()
        {
            var list    = new [] { metricLogic };
            var factory = new AttributeServiceFactory <IMetricLogic, string>(list);

            Assert.Throws <Exception>(() => factory.GetService(null));
        }
Exemplo n.º 2
0
        public void GetLogic_Success()
        {
            var list    = new [] { metricLogic };
            var factory = new AttributeServiceFactory <IMetricLogic, MetricType>(list);
            var result  = factory.GetService(MetricType.AgentUptime);

            Assert.That(result, Is.EqualTo(metricLogic));
        }
Exemplo n.º 3
0
        public void GetLogic_CantDetermineLogic()
        {
            var mockMetricLogic = new Mock <IMetricLogic>();
            var list            = new [] { mockMetricLogic.Object };
            var factory         = new AttributeServiceFactory <IMetricLogic, MetricType>(list);

            //Assert & Act
            Assert.Throws <Exception>(() => factory.GetService(MetricType.AgentUptime));
        }
Exemplo n.º 4
0
        public void GetLogic_NoMatchingLogic()
        {
            var list    = new [] { metricLogic };
            var factory = new AttributeServiceFactory <IMetricLogic, MetricType>(list);

            //Act
            var result = factory.GetService(MetricType.WebUptime);

            //Assert
            Assert.That(result, Is.Null);
        }