public void GetValue_JRaw_Null_Test(TestDataRow <string> row) { // Arrange var json = row.TestValue; JRaw raw = (json == null) ? null : new JRaw(json); // Act & Assert Assert.ThrowsException <ArgumentNullException>(() => raw.GetValue("Id")); }
public void GetValue_Property_NullEmptyOrWhitespace_Test(TestDataRow <string> row) { // Arrange var prop = row.TestValue; var msg = row.Message ?? row.Description; var raw = new JRaw("{ \"Id\" : 1, \"Prop1\" : \"Abc123\" }"); // Act & Assert Assert.ThrowsException <ArgumentNullException>(() => raw.GetValue(prop), msg); }
public static string GetValueAsString(this JRaw jRaw, string property) { return(jRaw.GetValue(property)?.ToString()); }