Пример #1
0
        public void TestAddModule()
        {
            var testModule = new Mock <IModule>();

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

            IBedsideMonitor testBedsideMonitor = new BedsideMonitor();

            testBedsideMonitor.AddModule(testModule.Object);
            List <IModule> testModuleList = testBedsideMonitor.GetListOfModules();

            CollectionAssert.Contains(testModuleList, testModule.Object);
        }
Пример #2
0
        public void TestGettingListOfModules()
        {
            BedsideMonitor testBedsideMonitor = new BedsideMonitor();

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

            moduleToAdd.Setup(a => a.LowerLimit).Returns(10f);
            moduleToAdd.Setup(b => b.Name).Returns("Test");
            moduleToAdd.Setup(c => c.UpperLimit).Returns(20f);

            testBedsideMonitor.AddModule(moduleToAdd.Object);

            List <IModule> testModuleList = testBedsideMonitor.GetListOfModules();

            CollectionAssert.Contains(testModuleList, moduleToAdd.Object);
        }
Пример #3
0
        public void TestAddingModuleToBedsideMonitor()
        {
            //arrange
            BedsideMonitor testBedsideMonitor = new BedsideMonitor();
            var            moduleToAdd        = new Mock <IModule>(MockBehavior.Strict);

            moduleToAdd.Setup(a => a.LowerLimit).Returns(10f);
            moduleToAdd.Setup(b => b.Name).Returns("Test");
            moduleToAdd.Setup(c => c.UpperLimit).Returns(20f);

            //act
            testBedsideMonitor.AddModule(moduleToAdd.Object);
            List <IModule> testModuleList = testBedsideMonitor.GetListOfModules();

            //assert

            Assert.IsTrue(testModuleList.Contains(moduleToAdd.Object));
        }
Пример #4
0
        public void RemovingModule()
        {
            //arrange
            BedsideMonitor testBedsideMonitor = new BedsideMonitor();
            var            moduleToRemove     = new Mock <IModule>(MockBehavior.Strict);

            moduleToRemove.Setup(a => a.LowerLimit).Returns(10f);
            moduleToRemove.Setup(b => b.Name).Returns("Test");
            moduleToRemove.Setup(c => c.UpperLimit).Returns(20f);

            //act
            testBedsideMonitor.ChangeModule(0, moduleToRemove.Object);
            testBedsideMonitor.RemoveModule(0);
            List <IModule> testModuleList = testBedsideMonitor.GetListOfModules();

            //assert

            Assert.IsFalse(testModuleList.Contains(moduleToRemove.Object));
        }
Пример #5
0
        public void TestChangeModule()
        {
            var testModuleOld = new Mock <IModule>();

            testModuleOld.Setup(a => a.Name).Returns("TestOld");
            testModuleOld.Setup(b => b.LowerLimit).Returns(10f);
            testModuleOld.Setup(c => c.UpperLimit).Returns(15f);

            var testModuleNew = new Mock <IModule>();

            testModuleNew.Setup(a => a.Name).Returns("TestOld");
            testModuleNew.Setup(b => b.LowerLimit).Returns(10f);
            testModuleNew.Setup(c => c.UpperLimit).Returns(15f);

            IBedsideMonitor testBedsideMonitor = new BedsideMonitor();

            testBedsideMonitor.AddModule(testModuleOld.Object);
            testBedsideMonitor.AddModule(testModuleOld.Object);
            testBedsideMonitor.ChangeModule(1, testModuleNew.Object);
            List <IModule> testModuleList = testBedsideMonitor.GetListOfModules();

            Assert.AreEqual(testModuleNew.Object, testModuleList[1]);
        }