private static NameValueCollection GetExtraAttributes(String json) { var result = new NameValueCollection(); var skip = new List<String> {"key", "name", "type", "updated_at", "dimensions"}; var material = new Deserializer().Deserialize(json); foreach (var attribute in material.Properties()) { un.less(() => skip.Contains(attribute.Name), () => { try { result.Add(attribute.Name, material.Value<String>(attribute.Name)); } catch (Exception e) { throw new Exception("Failed to get the values for the '" + attribute.Name + "' attribute", e); } }); } return result; }
private void Verify(Response response) { var json = new Deserializer().Deserialize(ReadAll(response)); Ensure(json); var deleted = json.Value<String>("deleted").ToLower(); var wasDeletedOkay = (deleted == "true"); un.less(wasDeletedOkay, () => { throw new Exception(String.Format( "Delete failed. Expected the deleted flag to be true. but it was \"{0}\".", deleted )); }); }