예제 #1
0
        public async void negative_expires_throws_exception()
        {
            // Arrange
            Mock <ISecret> mockSecret = new Mock <ISecret>();

            mockSecret.Setup(m => m.ValidityPeriodDays).Returns("-1");

            var rotator = new ServicePrincipalRotator();

            // Act and Assert
            var ex = await Assert.ThrowsAsync <InvalidSecretException>(() =>
                                                                       rotator.RotateSecretAsync(mockSecret.Object, logger));
        }
예제 #2
0
        public async void secret_expires_before_invalid_throws_exception()
        {
            // Arrange
            Mock <ISecret> mockSecret = new Mock <ISecret>();

            mockSecret.Setup(m => m.ValidityPeriodDays).Returns("60");
            mockSecret.Setup(m => m.ExpiresInDays).Returns("20");

            var rotator = new ServicePrincipalRotator();

            // Act and Assert
            var ex = await Assert.ThrowsAsync <SecretExpiresBeforeRotationException>(() =>
                                                                                     rotator.RotateSecretAsync(mockSecret.Object, logger));
        }