Exemplo n.º 1
0
        public void Given_Valid_Arguments_When_Multiple_Subscribe_Invoked_Then_Valid_Result_Asserted()
        {
            Callbacks callbacks           = new Callbacks();
            VitalsMonitoringFunction func = new VitalsMonitoringFunction(callbacks.VitalsCallback);

            vitalsMonitorList.Subscribe("patientId", "id", func);
            func = new VitalsMonitoringFunction(callbacks.VitalsCallback1);
            vitalsMonitorList.Subscribe("patientId1", "id1", func);
            SharedResources.VitalsMonitorList.VitalsMonitorList list = SharedResources.VitalsMonitorList.VitalsMonitorList.Instance;
            var           output = list.TryGetValue("patientId");
            PatientVitals alert  = new PatientVitals();

            foreach (var function in output)
            {
                function.Invoke(alert);
            }
            Assert.AreEqual("TestPassed", alert.PatientId);
            output = list.TryGetValue("patientId1");
            foreach (var function in output)
            {
                function.Invoke(alert);
            }
            Assert.AreEqual("TestPassed1", alert.PatientId);
            vitalsMonitorList.Unsubscribe("patientId", "id");
            vitalsMonitorList.Unsubscribe("patientId1", "id1");
        }
Exemplo n.º 2
0
        public void Given_Valid_Arguments_When_Multiple_Instance_Invoked_Then_Valid_Result_Asserted()
        {
            Callbacks callbacks           = new Callbacks();
            VitalsMonitoringFunction func = new VitalsMonitoringFunction(callbacks.VitalsCallback);

            vitalsMonitorList.Subscribe("patientId", "id", func);
            SharedResources.VitalsMonitorList.VitalsMonitorList list = SharedResources.VitalsMonitorList.VitalsMonitorList.Instance;
            Assert.IsFalse(list.IsEmpty());
            vitalsMonitorList.Unsubscribe("patientId", "id");
            Assert.IsTrue(list.IsEmpty());
        }
Exemplo n.º 3
0
 public void TestInitialize()
 {
     vitalsMonitorList = SharedResources.VitalsMonitorList.VitalsMonitorList.Instance;
 }