Esempio n. 1
0
        public void Test_CanMatch(string token, string key, StringComparison comparisonMode, bool expectedResult)
        {
            Mock <ICacheClient> cacheClientMocker =
                new Mock <ICacheClient>(MockBehavior.Loose);

            ICacheClient cacheClient = cacheClientMocker.Object;

            KeyEndsWithStringCacheClientRule rule =
                new KeyEndsWithStringCacheClientRule(cacheClient, comparisonMode, token);

            Assert.AreEqual(expectedResult, rule.Matches(key));
            Assert.AreSame(cacheClient, rule.Client);
        }
Esempio n. 2
0
        public void Test_CanMatch_MultipleTokens(string testKey, StringComparison comparisonMode, bool expectedMatch)
        {
            Mock <ICacheClient> cacheClientMocker =
                new Mock <ICacheClient>(MockBehavior.Loose);

            ICacheClient cacheClient = cacheClientMocker.Object;

            KeyEndsWithStringCacheClientRule rule = new KeyEndsWithStringCacheClientRule(cacheClient,
                                                                                         comparisonMode,
                                                                                         ":urn:iauthsession",
                                                                                         ":sess");

            Assert.AreEqual(expectedMatch, rule.Matches(testKey));
        }