// [Timeout(10000)] public async Task ResolveBackgroundEvent() { logger.Debug("ResolveBackgroundEvent - Start"); LayoutManager layoutManager = (LayoutManager)ServiceManager.LayoutManager; await layoutManager.VerifyLayoutAsync(true); BeaconAction orgAction = layoutManager.Layout.ResolvedActions.FirstOrDefault(ra => ra.BeaconAction.Uuid == "9ded63644e424d758b0218f7c70f2473").BeaconAction; List <Beacon> list = new List <Beacon>() { new Beacon() { Id1 = "7367672374000000ffff0000ffff0004", Id2 = 39178, Id3 = 30929 } }; BackgroundEngine engine = new BackgroundEngine(); TaskCompletionSource <BeaconAction> action = new TaskCompletionSource <BeaconAction>(); engine.BeaconActionResolved += (sender, args) => { action.SetResult(args); }; await engine.InitializeAsync(); await engine.ResolveBeaconActionsAsync(list, OUT_OF_RANGE_DB); BeaconAction result = await action.Task; Assert.AreEqual(orgAction, result, "action not found"); logger.Debug("ResolveBackgroundEvent - End"); }
public async Task ResolveMultipleAction() { logger.Debug("ResolveMultipleAction - Start"); LayoutManager layoutManager = (LayoutManager)ServiceManager.LayoutManager; await layoutManager.VerifyLayoutAsync(true); BackgroundEngine engine = new BackgroundEngine(); IList <BeaconAction> actions = new List <BeaconAction>(); engine.BeaconActionResolved += (sender, args) => { actions.Add(args); }; List <Beacon> list = new List <Beacon>() { new Beacon() { Id1 = "7367672374000000ffff0000ffff0003", Id2 = 48869, Id3 = 21321 } }; await engine.InitializeAsync(); await engine.ResolveBeaconActionsAsync(list, OUT_OF_RANGE_DB); Assert.AreEqual(4, actions.Count, "Not 4 action found"); logger.Debug("ResolveMultipleAction - End"); }