Beispiel #1
0
            public void ShouldReturnOk(
                [Frozen, Substitute] ICacheUtils cacheUtils,
                [Target] CacheController controller
                )
            {
                var result = controller.ClearAll();

                result.StatusCode.Should().Be((int)HttpStatusCode.OK);
            }
Beispiel #2
0
            public void ShouldInvalidateAllUserTokens(
                [Frozen, Substitute] ICacheUtils cacheUtils,
                [Target] CacheController controller
                )
            {
                controller.ClearAll();

                cacheUtils.Received().InvalidateAllUserTokens();
            }
Beispiel #3
0
            public void ShouldInvalidateTheIdentityToken(
                [Frozen, Substitute] ICacheUtils cacheUtils,
                [Target] CacheController controller
                )
            {
                controller.ClearAll();

                cacheUtils.Received().InvalidatePrimaryToken();
            }
Beispiel #4
0
            public void ShouldRemoveAnyUserTokensForTheGivenIdentityId(
                Guid identityId,
                [Frozen, Substitute] ICacheUtils cacheUtils,
                [Target] CacheController controller
                )
            {
                controller.ClearUserSpecificCache(identityId);

                cacheUtils.Received().InvalidateTokensForUser(Is(identityId.ToString()));
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheController" /> class.
 /// </summary>
 /// <param name="userIdCache">Cache to control user IDs.</param>
 /// <param name="cacheUtils">Utilities for working with the identity cache.</param>
 /// <param name="commandsCache">Service for managing the Brighid Commands cache.</param>
 /// <param name="logger">Logger used to log info to some destination(s).</param>
 public CacheController(
     IUserIdCache userIdCache,
     ICacheUtils cacheUtils,
     IBrighidCommandsCache commandsCache,
     ILogger <CacheController> logger
     )
 {
     this.userIdCache   = userIdCache;
     this.cacheUtils    = cacheUtils;
     this.commandsCache = commandsCache;
     this.logger        = logger;
 }
Beispiel #6
0
 public CachingBehavior(ILogger <CachingBehavior <TRequest, TResponse> > logger, ICacheUtils cacheUtils)
 {
     _logger     = logger;
     _cacheUtils = cacheUtils;
 }