Ejemplo n.º 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);
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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]);
        }
Ejemplo n.º 4
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);
        }