예제 #1
0
        public void AreAllKeysWithinInitializationDuration_should_ignore_retired_and_expired_keys()
        {
            {
                var key1 = CreateKey(_options.KeyRetirementAge);
                var key2 = CreateKey(_options.RotationInterval);
                var key3 = CreateKey(_options.InitializationDuration.Add(-TimeSpan.FromSeconds(1)));

                var result = _subject.AreAllKeysWithinInitializationDuration(new[] { key1, key2, key3 });

                result.Should().BeTrue();
            }
            {
                var key1 = CreateKey(_options.KeyRetirementAge.Add(TimeSpan.FromSeconds(1)));
                var key2 = CreateKey(_options.RotationInterval.Add(TimeSpan.FromSeconds(1)));
                var key3 = CreateKey(_options.InitializationDuration.Add(-TimeSpan.FromSeconds(1)));

                var result = _subject.AreAllKeysWithinInitializationDuration(new[] { key1, key2, key3 });

                result.Should().BeTrue();
            }
        }