public void Add()
        {
            var cache   = new Mock <ICache>(MockBehavior.Strict);
            var service = new SignatureCache(cache.Object);

            var dt = DateTimeOffset.UtcNow;

            cache.Setup(x => x.Set("A", "hmac signature", dt, "hmac"));

            service.Add("A", dt);
        }
        public void CacheHit()
        {
            var cache   = new Mock <ICache>(MockBehavior.Strict);
            var service = new SignatureCache(cache.Object);

            cache.Setup(x => x.Contains("A", "hmac")).Returns(true);

            var candidate = service.Contains("A");

            Assert.That(candidate, Is.True, "Cache entry differs");
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SyntaxRenderer"/> class.
 /// </summary>
 /// <param name="resolver">The resolver.</param>
 /// <param name="signatureResolver">The signature service.</param>
 /// <param name="renderer">The renderer.</param>
 /// <param name="urlResolver">The URL resolver.</param>
 public SyntaxRenderer(
     DocumentModelResolver resolver,
     SignatureCache signatureResolver,
     SignatureRenderer renderer,
     UrlResolver urlResolver)
 {
     _resolver          = resolver;
     _signatureResolver = signatureResolver;
     _renderer          = renderer;
     _urlResolver       = urlResolver;
 }
示例#4
0
 public ApiServices(
     DocumentModel model,
     DocumentModelResolver documentModelResolver,
     UrlResolver urlResolver,
     SignatureRenderer signatureRenderer,
     LanguageProvider languageProvider,
     SyntaxRenderer syntaxRenderer,
     SignatureCache signatureResolver)
 {
     Model             = model;
     ModelResolver     = documentModelResolver;
     UrlResolver       = urlResolver;
     SignatureRenderer = signatureRenderer;
     LanguageProvider  = languageProvider;
     SyntaxRenderer    = syntaxRenderer;
     SignatureResolver = signatureResolver;
 }