Inheritance: Aqueduct.Monitoring.Sensors.SensorBase
コード例 #1
0
        public void AddReading_WhenReadingDataNameNotSet_UsesTheSensorReadingName()
        {
            var sensor = new SensorTestDouble("test");

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().Data.Name, Is.EqualTo("test"));
        }
コード例 #2
0
        public void GetFeatureName_WithFeatureName_SetsFeatureNameForAllReadingsAdded()
        {
            string featureName = "Feature1";

            var sensor = new SensorTestDouble("readingName") { FeatureName = featureName };

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo(featureName));
        }
コード例 #3
0
        public void AddReading_WhenReadingDataNameNotSet_UsesTheSensorReadingName()
        {
            var sensor = new SensorTestDouble("test");

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().Data.Name, Is.EqualTo("test"));
        }
コード例 #4
0
        public void SetThreadScopedFeatureName_WithoutFeatureGroupSpecified_SetsFeatureGroupToGlobal()
        {
            SensorBase.SetThreadScopedFeatureName("test");

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(FeatureStatistics.GlobalGroupName));
        }
コード例 #5
0
        public void GetFeatureGroup_WithoutOneSpecified_SetsGroupToGlobal()
        {
            var sensor = new SensorTestDouble("test") { FeatureName = "featureName" };

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().FeatureGroup, Is.EqualTo(FeatureStatistics.GlobalGroupName));
        }
コード例 #6
0
        public void GetFeatureName_WhenFeatureNameIsInThreadContext_ReturnsTheOneFromTheThreadContext()
        {
            string featureName = "datapointName";
			SensorBase.SetThreadScopedFeatureName(featureName);

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo(featureName));
        }
コード例 #7
0
        public void GetFeatureName_WhenFeatureNameIsInThreadContext_ReturnsTheOneFromTheThreadContext()
        {
            string featureName = "datapointName";

            SensorBase.SetThreadScopedFeatureName(featureName);

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo(featureName));
        }
コード例 #8
0
        public void AddReading_WhenReadingDateNameIsSet_UsesTheReadingDataNameInsteadOfSensorReadingName()
        {
            string readingDataName = "ReadingDataName";
            string sensorReadingName = "SenorReadingName";
            var sensor = new SensorTestDouble(sensorReadingName);

            sensor.Add(new Int32ReadingData(1) { Name = readingDataName });

            Assert.That(ReadingPublisher.Readings.First().Data.Name, Is.EqualTo(readingDataName));
        }
コード例 #9
0
        public void ClearThreadScoredFeatureName_AfterSettingFeatureNameToTest_ReturnsApplication()
        {
            string featureName = "datapointName";
            SensorBase.SetThreadScopedFeatureName(featureName);

            var sensor = new SensorTestDouble("test");
            SensorBase.ClearThreadScopedFeatureName();

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo("Application"));
        }
コード例 #10
0
        public void SetThreadScopeFeatureName_WithFeatureGroupSpecified_SetsFeatureGroupAccordingly()
        {
            string testGroup = "testGroup";

            SensorBase.SetThreadScopedFeatureName("test", testGroup);

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(testGroup));
        }
コード例 #11
0
        public void GetFeatureName_WithFeatureName_SetsFeatureNameForAllReadingsAdded()
        {
            string featureName = "Feature1";

            var sensor = new SensorTestDouble("readingName")
            {
                FeatureName = featureName
            };

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo(featureName));
        }
コード例 #12
0
        public void GetFeatureGroup_WithoutOneSpecified_SetsGroupToGlobal()
        {
            var sensor = new SensorTestDouble("test")
            {
                FeatureName = "featureName"
            };

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().FeatureGroup, Is.EqualTo(FeatureStatistics.GlobalGroupName));
        }
コード例 #13
0
        public void SetThreadScopeFeatureName_WhenFeatureGroupIsSetBothInSensorAndInThreadContext_TheSensorValueIsUsed()
        {
            SensorBase.SetThreadScopedFeatureName("test", "threadScopedGroup");

            string sensorGroup = "SensorGroup";
            var    sensor      = new SensorTestDouble("test")
            {
                FeatureName = "Name", FeatureGroup = sensorGroup
            };

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(sensorGroup));
        }
コード例 #14
0
        public void GetFeatureGroup_WithOneSet_SetsCorrectGroupToReading()
        {
            string group  = "featureGroup";
            var    sensor = new SensorTestDouble("test")
            {
                FeatureName = "featureName", FeatureGroup = group
            };

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().FeatureGroup, Is.EqualTo(group));
        }
コード例 #15
0
        public void ClearThreadScoredFeatureName_AfterSettingFeatureNameToTest_ReturnsApplication()
        {
            string featureName = "datapointName";

            SensorBase.SetThreadScopedFeatureName(featureName);

            var sensor = new SensorTestDouble("test");

            SensorBase.ClearThreadScopedFeatureName();

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo("Application"));
        }
コード例 #16
0
        public void AddReading_WhenReadingDateNameIsSet_UsesTheReadingDataNameInsteadOfSensorReadingName()
        {
            string readingDataName   = "ReadingDataName";
            string sensorReadingName = "SenorReadingName";
            var    sensor            = new SensorTestDouble(sensorReadingName);

            sensor.Add(new Int32ReadingData(1)
            {
                Name = readingDataName
            });

            Assert.That(ReadingPublisher.Readings.First().Data.Name, Is.EqualTo(readingDataName));
        }
コード例 #17
0
        public void SetThreadScopeFeatureName_WithFeatureGroupSpecified_AddReadingWithCorrectGroupName()
        {
            string testGroup = "testGroup";

            SensorBase.SetThreadScopedFeatureName("test", testGroup);

            var sensor = new SensorTestDouble("test");

            sensor.Add(new Int32ReadingData(1));
            Reading reading = null;

            ReadingPublisher.Readings.TryDequeue(out reading);

            Assert.That(reading.FeatureGroup, Is.EqualTo(testGroup));
        }
コード例 #18
0
        public void AddReading_WhenNoDataPointNameAvailable_SetsReadingNameTo_Application()
        {
            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo("Application"));
        }
コード例 #19
0
        public void AddReading_WhenNoDataPointNameAvailable_SetsReadingNameTo_Application()
        {
            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Name, Is.EqualTo("Application"));
        }
コード例 #20
0
        public void SetThreadScopeFeatureName_WithFeatureGroupSpecified_AddReadingWithCorrectGroupName()
        {
            string testGroup = "testGroup";
            SensorBase.SetThreadScopedFeatureName("test", testGroup);

            var sensor = new SensorTestDouble("test");
            sensor.Add(new Int32ReadingData(1));
            Reading reading = null;
            ReadingPublisher.Readings.TryDequeue(out reading);

            Assert.That(reading.FeatureGroup, Is.EqualTo(testGroup));
        }
コード例 #21
0
        public void SetThreadScopeFeatureName_WithFeatureGroupSpecified_SetsFeatureGroupAccordingly()
        {
            string testGroup = "testGroup";
            SensorBase.SetThreadScopedFeatureName("test", testGroup);

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(testGroup));
        }
コード例 #22
0
        public void SetThreadScopeFeatureName_WhenFeatureGroupIsSetBothInSensorAndInThreadContext_TheSensorValueIsUsed()
        {
            SensorBase.SetThreadScopedFeatureName("test", "threadScopedGroup");

            string sensorGroup = "SensorGroup";
            var sensor = new SensorTestDouble("test") { FeatureName = "Name", FeatureGroup = sensorGroup };

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(sensorGroup));
        }
コード例 #23
0
        public void GetFeatureGroup_WithOneSet_SetsCorrectGroupToReading()
        {
            string group = "featureGroup";
            var sensor = new SensorTestDouble("test") { FeatureName = "featureName", FeatureGroup = group };

            sensor.Add(new Int32ReadingData(1));

            Assert.That(ReadingPublisher.Readings.First().FeatureGroup, Is.EqualTo(group));
        }
コード例 #24
0
        public void SetThreadScopedFeatureName_WithoutFeatureGroupSpecified_SetsFeatureGroupToGlobal()
        {
            SensorBase.SetThreadScopedFeatureName("test");

            var sensor = new SensorTestDouble("test");

            Assert.That(sensor.GetFeatureNameExposed().Group, Is.EqualTo(FeatureStatistics.GlobalGroupName));
        }
コード例 #25
0
 public void Initialise()
 {
     FeatureName = new SensorTestDouble("test").GetFeatureNameExposed().Name;
     //some initialisation code is happending here
     Calucalte();
 }