public void WhenAddSubscription_ThenReturnsId()
            {
                var subscription = new WebhookSubscription
                {
                    Event       = "aneventname",
                    CreatedById = "auserid"
                };
                var result = store.Add(subscription);

                Assert.That(result.IsEntityId(), Is.True);
                cacheClient.Verify(cc => cc.Add(CacheClientSubscriptionStore.FormatCacheKey("auserid", "aneventname"), It.Is <WebhookSubscription>(sub
                                                                                                                                                   => sub.Id.IsEntityId())));
            }
            public void WhenFind_ThenReturnsSubscriptions()
            {
                var subscription = new WebhookSubscription();

                cacheClient.Setup(cc => cc.Get <object>("akey"))
                .Returns(subscription);

                var result = store.Find("auserid");

                Assert.That(result[0], Is.EqualTo(subscription));
                cacheClient.As <ICacheClientExtended>().Verify(cc => cc.GetKeysByPattern(CacheClientSubscriptionStore.FormatCacheKey("auserid", null) + "*"));
                cacheClient.Verify(cc => cc.Get <object>("akey"));
            }
            public void WhenFormatCacheKeyAndUserId_ThenReturnsUserkey()
            {
                var result = CacheClientSubscriptionStore.FormatCacheKey("auserid", "aneventname");

                Assert.That(result, Is.EqualTo(CacheClientSubscriptionStore.FormatCacheKey("auserid", "aneventname")));
            }
            public void WhenFormatCacheKeyAndNullUserId_ThenReturnsAnonymousUserkey()
            {
                var result = CacheClientSubscriptionStore.FormatCacheKey(null, "aneventname");

                Assert.That(result, Is.EqualTo(CacheClientSubscriptionStore.FormatCacheKey(CacheClientSubscriptionStore.CacheKeyForAnonymousUser, "aneventname")));
            }