public void Can_exclude_properties_scoped() { var dto = new Exclude {Id = 1, Key = "Value"}; using (var config = JsConfig.BeginScope()) { config.ExcludePropertyReferences = new[] {"Exclude.Id"}; Assert.That(dto.ToJson(), Is.EqualTo("{\"Key\":\"Value\"}")); Assert.That(dto.ToJsv(), Is.EqualTo("{Key:Value}")); } }
public void Can_exclude_properties() { JsConfig<Exclude>.ExcludePropertyNames = new[] { "Id" }; var dto = new Exclude { Id = 1, Key = "Value" }; Assert.That(dto.ToJson(), Is.EqualTo("{\"Key\":\"Value\"}")); Assert.That(dto.ToJsv(), Is.EqualTo("{Key:Value}")); }