public Handler( IDnsService dns, ICacheService cache, IOptions <CacheExpirerOptions> options ) { this.dns = dns; this.cache = cache; this.options = options.Value; }
public async Task ShouldClearCommandCache( string command, IPAddress ip1, IPAddress ip2, SnsMessage <CacheExpirationRequest> request, [Frozen] IDnsService dns, [Frozen] ICacheService cache, [Frozen] CacheExpirerOptions options, [Target] Handler handler, CancellationToken cancellationToken ) { request.Message.Type = CacheExpirationType.Command; request.Message.Id = command; dns.GetIPAddresses(Any <string>(), Any <CancellationToken>()).Returns(new[] { ip1, ip2 }); await handler.Handle(request, cancellationToken); await dns.Received().GetIPAddresses(Is(options.AdapterUrl), Is(cancellationToken)); await cache.Received().ExpireCommandCache(Is(ip1), Is(command), Is(cancellationToken)); await cache.Received().ExpireCommandCache(Is(ip2), Is(command), Is(cancellationToken)); }