public void DoTests(InputSubReq sr, int value, int expectedCount) { _subHelper.SubHandler.FireCallbacks(sr.BindingDescriptor, value); Assert.That(_subHelper.CallbackResults[sr.Name].Value, Is.EqualTo(value), "Value should be correct"); Assert.That(_subHelper.CallbackResults[sr.Name].BindingDescriptor, Is.EqualTo(sr.BindingDescriptor), "BindingDescriptor should match binding"); Assert.That(_subHelper.CallbackResults.Count, Is.EqualTo(expectedCount), "Number of callbacks should be correct"); }
public int CountIndexesTests(SubscriptionType subscriptionType, InputSubReq sr) { var subReq = _subHelper.BuildSubReq(sr); if (subscriptionType == SubscriptionType.Subscribe) { _subHelper.SubHandler.Subscribe(subReq); } else { _subHelper.SubHandler.Unsubscribe(subReq); } var c = 0; try { foreach (var index in _subHelper.SubHandler[sr.BindingDescriptor.Type][sr.BindingDescriptor.Index]) { c++; } } catch (KeyNotFoundException) { c = 0; } return(c); }
public int CountIndexesTests(InputSubReq sr) { var subReq = _subHelper.BuildSubReq(sr); _subHelper.SubHandler.Unsubscribe(subReq); return(_subHelper.DeviceEmptyResults.Count()); }
public int CountIndexesTests(SubscriptionType subscriptionType, InputSubReq sr) { var subReq = _subHelper.BuildSubReq(sr); if (subscriptionType == SubscriptionType.Subscribe) { _subHelper.SubHandler.Subscribe(subReq); } else { _subHelper.SubHandler.Unsubscribe(subReq); } return(_subHelper.SubHandler.Count(subReq.BindingDescriptor.Type)); }
public bool CountTypesTests(SubscriptionType subscriptionType, InputSubReq sr) { var subReq = _subHelper.BuildSubReq(sr); if (subscriptionType == SubscriptionType.Subscribe) { _subHelper.SubHandler.Subscribe(subReq); } else { _subHelper.SubHandler.Unsubscribe(subReq); } return(_subHelper.SubHandler.ContainsKey(sr.BindingDescriptor.Type)); }
public InputSubscriptionRequest BuildSubReq(InputSubReq sr) { var subReq = new InputSubscriptionRequest { DeviceDescriptor = sr.DeviceDescriptor, BindingDescriptor = sr.BindingDescriptor, SubscriptionDescriptor = sr.SubscriptionDescriptor, Callback = new Action <short>(value => { //CallbackResults.Add(sr.Name , new CallbackResult {BindingDescriptor = sr.BindingDescriptor, Value = value}); }) }; return(subReq); }
public int EnumerateTypeTests(SubscriptionType subscriptionType, InputSubReq sr) { var subReq = _subHelper.BuildSubReq(sr); if (subscriptionType == SubscriptionType.Subscribe) { _subHelper.SubHandler.Subscribe(subReq); } else { _subHelper.SubHandler.Unsubscribe(subReq); } var c = 0; foreach (var index in _subHelper.SubHandler) { c++; } return(c); }
public void DoTests(InputSubReq sr, int value) { Assert.That(_subHelper.CallbackResults[sr.Name].Value, Is.EqualTo(value), "Value should be correct"); Assert.That(_subHelper.CallbackResults[sr.Name].BindingDescriptor, Is.EqualTo(sr.BindingDescriptor), "BindingDescriptor should match binding"); }