public void TestReadFail() { var client = new SecretHub.Client(); Regex expectedErrorRegex = new Regex(@"^.*\(server\.secret_not_found\) $"); var ex = Assert.Throws <ApplicationException>(() => client.Read("secrethub/xgo/dotnet/test/not-this-one")); Assert.True(expectedErrorRegex.IsMatch(ex.Message), "error should end in the (server.secret_not_found) error code"); }
public void TestReadSuccess() { var client = new SecretHub.Client(); SecretHub.SecretVersion secret = client.Read("secrethub/xgo/dotnet/test/test-secret:3"); Assert.Equal(new Guid("529beaaf-9934-432f-a6b0-c5cb7e847458"), secret.SecretVersionID); Assert.Equal(new Guid("c37ec233-e168-436d-8b06-48c52aa22d5e"), secret.Secret.SecretID); Assert.Equal(3, secret.Version); Assert.Equal("super_secret_value", secret.Data); Assert.Equal(DateTime.Parse("10/1/2020 2:22:08 PM", System.Globalization.CultureInfo.InvariantCulture), secret.CreatedAt); Assert.Equal(DateTime.Parse("10/1/2020 10:49:33 AM", System.Globalization.CultureInfo.InvariantCulture), secret.Secret.CreatedAt); Assert.Equal("ok", secret.Status); }