BrakePedal.Tests.MemoryThrottleRepositoryTests.AddOrIncrementWithExpirationMethod.RetrieveValidThrottleCountFromRepostitory C# (CSharp) Méthode

RetrieveValidThrottleCountFromRepostitory() private méthode

private RetrieveValidThrottleCountFromRepostitory ( ) : void
Résultat void
            public void RetrieveValidThrottleCountFromRepostitory()
            {
                // Arrange
                var key = new SimpleThrottleKey("test", "key");
                var limiter = new Limiter()
                    .Limit(1)
                    .Over(100);
                var cache = new MemoryCache("testing_cache");
                var repository = new MemoryThrottleRepository(cache);
                string id = repository.CreateThrottleKey(key, limiter);

                var cacheItem = new MemoryThrottleRepository.ThrottleCacheItem()
                {
                    Count = 1,
                    Expiration = new DateTime(2030, 1, 1)
                };

                repository.AddOrIncrementWithExpiration(key, limiter);

                // Act
                var count = repository.GetThrottleCount(key, limiter);

                // Assert
                Assert.Equal(count, 1);
            }