public void Given_Invalid_Arguments_When_TryGetValue_Invoked_Then_Invalid_Result_Asserted() { Callbacks callbacks = new Callbacks(); AlertMonitoringFunction func = new AlertMonitoringFunction(callbacks.CallbackFunc); alertMonitorList.Subscribe("id", func); Assert.IsNull(alertMonitorList.TryGetValue("id2")); alertMonitorList.Unsubscribe("id"); }
public void Given_Valid_Arguments_When_Multiple_Subscribe_Invoked_Then_Valid_Result_Asserted() { Callbacks callbacks = new Callbacks(); AlertMonitoringFunction func = new AlertMonitoringFunction(callbacks.CallbackFunc); alertMonitorList.Subscribe("id", func); func = new AlertMonitoringFunction(callbacks.CallbackFunc1); alertMonitorList.Subscribe("id1", func); SharedResources.AlertMonitorList.AlertMonitorList list = SharedResources.AlertMonitorList.AlertMonitorList.Instance; var output = list.TryGetValue("id"); PatientAlert alert = new PatientAlert(); output?.Invoke(alert); Assert.AreEqual("TestPassed", alert.PatientId); output = list.TryGetValue("id1"); output?.Invoke(alert); Assert.AreEqual("TestPassed1", alert.PatientId); alertMonitorList.Unsubscribe("id"); alertMonitorList.Unsubscribe("id1"); }