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]); }
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); }
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); }
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)); }