public void When_Full_Redaction_Redact_Everything() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.Full; var redactor = new Redactor(ctx); Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString()); Assert.Equal("<md>meta</md>", redactor.MetaData("meta").ToString()); Assert.Equal("<sd>system</sd>", redactor.SystemData("system").ToString()); }
public void When_User_Redaction_Redact_Partial() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.Partial; var redactor = new Redactor(ctx); Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString()); Assert.Equal("meta", redactor.MetaData("meta").ToString()); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public void When_Redaction_Disabled_No_Redaction_Occurs() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.None; var redactor = new Redactor(ctx); Assert.Equal("1", redactor.UserData("1").ToString()); Assert.Null(redactor.MetaData(null)); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public override IScope Scope(string scopeName) { if (scopeName == KeyValue.Scope.DefaultScopeName) { // Base will do the logging return(base.Scope(scopeName)); } // Log here so we have info when we hit the exception path Logger.LogDebug("Fetching scope {scopeName}", Redactor.MetaData(scopeName)); throw new NotSupportedException("Only the default Scope is supported by Memcached Buckets"); }
public void When_Redaction_Disabled_No_Redaction_Occurs() { var options = new ClusterOptions { RedactionLevel = RedactionLevel.None }; var redactor = new Redactor(options); Assert.Equal("1", redactor.UserData("1").ToString()); Assert.Null(redactor.MetaData(null)); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public void When_User_Redaction_Redact_Partial() { var options = new ClusterOptions { RedactionLevel = RedactionLevel.Partial }; var redactor = new Redactor(options); Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString()); Assert.Equal("meta", redactor.MetaData("meta").ToString()); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public override IScope this[string scopeName] { get { Logger.LogDebug("Fetching scope {scopeName}", Redactor.MetaData(scopeName)); if (scopeName == KeyValue.Scope.DefaultScopeName) { if (Scopes.TryGetValue(scopeName, out var scope)) { return(scope); } } throw new NotSupportedException("Only the default Scope is supported by Memcached Buckets"); } }