示例#1
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));
        }
示例#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));
        }
示例#3
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));
        }
示例#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));
        }