Beispiel #1
0
        public void GetAlarmTesterName()
        {
            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester testAlarmTester = new AlarmTester(testModule.Object);

            string alarmName = testAlarmTester.NameOfAlarm;

            Assert.AreEqual(testModule.Object.Name, testAlarmTester.NameOfAlarm);
        }
Beispiel #2
0
        public void AlarmDoesNotDetectMinusValues()
        {
            // This test should pass if the values detected in the setup is not equal to -2f (NW)

            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester alarmTesterCreated = new AlarmTester(testModule.Object);

            Assert.IsTrue(alarmTesterCreated.ValueOutsideLimits(-2f));
        }
Beispiel #3
0
        public void  IsAlarmGreaterThanZero()
        {
            // This test should pass since the values setup is above 0. (NW)

            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester alarmTesterCreated = new AlarmTester(testModule.Object);

            Assert.IsTrue(alarmTesterCreated.ValueOutsideLimits(0f));
        }
Beispiel #4
0
        public void IsAlarmOutsideLimits()
        {
            /* This test method will test whether the values are outside the setup values 12f and 54f.
             * If they are outside the test should pass. If in between should fail. (NW) */

            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester alarmTesterCreated = new AlarmTester(testModule.Object);

            Assert.IsTrue(alarmTesterCreated.ValueOutsideLimits(11f));
        }
Beispiel #5
0
        public void AlarmIsWithinLimits()
        {
            /* This test method will test whether the alarm values are in between the values 12f and 54f.
             * If the values fall in between 12 and 54 the test should pass. (NW) */

            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester alarmTesterCreated = new AlarmTester(testModule.Object);

            Assert.IsFalse(alarmTesterCreated.ValueOutsideLimits(13f));
        }
Beispiel #6
0
        public void IsAlarmLowerLimitSetToModuleLowerLimit()
        {
            /* This test method test whether the created alarm is the same as the one setup for the test initialize above.
             * If the elements below this comment is the same as the one created the test will pass, else the test will fail. (NW)*/

            var testModule = new Mock <IModule>(MockBehavior.Strict);

            testModule.Setup(a => a.LowerLimit).Returns(12f);
            testModule.Setup(b => b.Name).Returns("Test");
            testModule.Setup(c => c.UpperLimit).Returns(54f);

            IAlarmTester alarmTesterCreated = new AlarmTester(testModule.Object);

            Assert.AreEqual(testModule.Object.LowerLimit, alarmTesterCreated.LowerLimit);
        }
Beispiel #7
0
 public void setup()
 {
     alarmTesterCreated = new AlarmTester("Module Name", 12f, 54f);
     // alarmTesterCreated = new AlarmTester("Module Name", 0f, 0f);
 }
 public void setup()
 {
     createdAlarmTester = new AlarmTester("Test Name", 10f, 20f);
 }