Exemplo n.º 1
0
        public void TestReadStringSuccess()
        {
            var    client = new SecretHub.Client();
            string secret = client.ReadString("secrethub/xgo/dotnet/test/test-secret");

            Assert.Equal("super_secret_value", secret);
        }
Exemplo n.º 2
0
        public void TestReadStringFail()
        {
            var   client             = new SecretHub.Client();
            Regex expectedErrorRegex = new Regex(@"^.*\(server\.secret_not_found\) $");
            var   ex = Assert.Throws <ApplicationException>(() => client.ReadString("secrethub/xgo/dotnet/test/not-this-one"));

            Assert.True(expectedErrorRegex.IsMatch(ex.Message), "error should end in the (server.secret_not_found) error code");
        }
Exemplo n.º 3
0
        public void TestWriteSuccess()
        {
            var client = new SecretHub.Client();

            client.Write("secrethub/xgo/dotnet/test/new-secret", "new_secret_value");
            String secret = client.ReadString("secrethub/xgo/dotnet/test/new-secret");

            Assert.Equal("new_secret_value", secret);
            client.Remove("secrethub/xgo/dotnet/test/new-secret");
        }