예제 #1
0
        public void Get_NameNullOrEmpty_ThrowsArgumentNullException(string name)
        {
            var clientFake = A.Fake <IVaultClient>();

            var appSettings = new VaultSecretAppSettings(clientFake, "path");

            Action get = () => appSettings.Get <string>(name, null);

            get.ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("name");
        }
예제 #2
0
        public void Get_ClientServiceClientThrowsException_ReturnsDefaultValue()
        {
            var clientFake = A.Fake <IVaultClient>();

            A.CallTo(() => clientFake.ServiceClient).Throws <Exception>();

            var appSettings = new VaultSecretAppSettings(clientFake, "path");
            var result      = appSettings.Get("secret", "defaultsecretvalue");

            result.Should().Be("defaultsecretvalue");

            A.CallTo(() => clientFake.ServiceClient).MustHaveHappened();
        }