public void return_true_when_2_sentinel_key_arent_equals() { var sentinelKey1 = new SentinelKey("sentinel1"); var sentinelKey2 = new SentinelKey("sentinel2"); Check.That(sentinelKey1 != sentinelKey2).IsEqualTo(true); }
public SubscriptionKey AddSubscription(SentinelKey clientSentinelKey, string stateValueSentinelName, string stateValuePackageName, string stateValueName) { var stateValueKey = _stateValueManager.GetStateValueKey(stateValueSentinelName, stateValuePackageName, stateValueName); var subscriptionOnStateValue = SubscriptionOnStateValue.CreateSubscriptionOnStateValue( _stateValueManager.GetStateValueKey(stateValueSentinelName, stateValuePackageName, stateValueName)); if (_subscriptions.ContainsKey(clientSentinelKey)) { var stateValueKeys = _subscriptions[clientSentinelKey].Where(v => v.StateValueKey == stateValueKey); if (stateValueKeys.Any()) { stateValueKeys.First().Id = subscriptionOnStateValue.Id; } else { _subscriptions[clientSentinelKey].Add(subscriptionOnStateValue); } } else { _subscriptions.Add(clientSentinelKey, new List <SubscriptionOnStateValue> { subscriptionOnStateValue }); } SubscribeOnValueChangedEventIfStateValueExist(stateValueKey); return(subscriptionOnStateValue.Id); }
public void return_true_when_2_sentinel_key_are_equals_with_override_equals_method() { var sentinelKey1 = new SentinelKey("sentinel1"); var sentinelKey2 = new SentinelKey("sentinel1"); Check.That(sentinelKey1.Equals(sentinelKey2)).IsEqualTo(true); }
private void RemoveSubscriptionSentinelKeyEntryIfEmpty(SentinelKey sentinelKey) { if (!_subscriptions[sentinelKey].Any()) { _subscriptions.Remove(sentinelKey); } }
public Subscription(string sentinelKey, string stateValueSentinelName, string stateValuePackageName, string stateValueName) { SentinelKey = new SentinelKey(sentinelKey); StateValueSentinelName = stateValueSentinelName; StateValuePackageName = stateValuePackageName; StateValueName = stateValueName; }
public bool RemoveSubscription(SentinelKey sentinelKey, SubscriptionKey subscriptionId) { if (_subscriptions.Any(s => s.Key == sentinelKey)) { _subscriptions[sentinelKey].RemoveAll(s => s.Id == subscriptionId); RemoveSubscriptionSentinelKeyEntryIfEmpty(sentinelKey); return(true); } else { throw new NoSubscriptionFoundException(); } }
public void return_true_when_second_sentinel_key_is_null_on_different() { var sentinelKey = new SentinelKey("sentinel1"); Check.That(null != sentinelKey).IsTrue(); }
public void return_false_when_second_sentinel_key_is_null_on_equal() { var sentinelKey = new SentinelKey("sentinel1"); Check.That(null == sentinelKey).IsFalse(); }
public SentinelSubscriptions(SentinelKey sentinelKey) { SentinelKey = sentinelKey; StateValueKeys = new List <StateValueKey>(); }
public bool Delete(SentinelKey sentinelKey, SubscriptionKey subscriptionKey) { return(_subscriptionManager.RemoveSubscription(sentinelKey, subscriptionKey)); }