private CrudContext GetCrudContext() { if (crudContext == null) { crudContext = new CrudContext(appName, username, password); } return(crudContext); }
public static CrudContext DeleteItem(this CrudContext runner) { var response = runner.crud.Delete(runner.ObjectName, runner.Id); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK); response = runner.crud.GetOne(runner.ObjectName, runner.Id); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.NotFound); return(runner); }
public static CrudContext UpdateItem(this CrudContext runner, BackObject dataToUpdate) { var response = runner.crud.Put(runner.ObjectName, runner.Id, dataToUpdate, null, true); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK); var result = JsonConvert.DeserializeObject <BackObject>(response.Content); AssertDeepEqual(dataToUpdate, result); return(runner); }
public static CrudContext ReadOneItem(this CrudContext runner, BackObject dataToCompare, string id) { var response = runner.crud.GetOne(runner.ObjectName, id); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK); var result = JsonConvert.DeserializeObject <BackObject>(response.Content); AssertDeepEqual(dataToCompare, result); return(runner); }
public static CrudContext CreateItem(this CrudContext runner, BackObject dataForCreate) { var response = runner.crud.Post(runner.ObjectName, dataForCreate, runner.DeepOnUpdate); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK); var result = JsonConvert.DeserializeObject <BackObject>(response.Content); var id = ((Newtonsoft.Json.Linq.JObject)result["__metadata"])["id"].ToString(); runner.DataForCreate = dataForCreate; runner.Id = id; return(runner); }
public static CrudContext ReadOneItem(this CrudContext runner) { runner.ReadOneItem(runner.DataForCreate, runner.Id); return(runner); }
public static CrudContext AddFilter(this CrudContext runner, FilterItem item) { runner.filter.Add(item); return(runner); }
public static CrudContext AddDeepOnUpdate(this CrudContext runner) { runner.DeepOnUpdate = true; return(runner); }