This commit is contained in:
@@ -16,7 +16,9 @@ namespace raven_integration
|
||||
[Fact]
|
||||
public async void CRUD()
|
||||
{
|
||||
//CREATE HEADER
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// CREATE
|
||||
//
|
||||
dynamic d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "WOHEADER The quick brown fox jumped over the six lazy dogs!";
|
||||
@@ -33,8 +35,8 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE WOITEM
|
||||
#region CREATE first woitem
|
||||
//CREATE WOITEM 1
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitem The quick brown fox jumped over the six lazy dogs!";
|
||||
@@ -50,7 +52,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("workorders/items", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderItemId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
long WorkOrderItem1Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +61,7 @@ namespace raven_integration
|
||||
d.active = true;
|
||||
d.notes = "woitempart The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitempart test wiki";
|
||||
d.workOrderItemId = WorkOrderItemId;
|
||||
d.workOrderItemId = WorkOrderItem1Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
@@ -73,15 +75,13 @@ namespace raven_integration
|
||||
long WorkOrderItemPartId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
//CREATE WOITEMLABOR(S)
|
||||
|
||||
//ONE
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitemlabor The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitemlabor test wiki";
|
||||
d.workOrderItemId = WorkOrderItemId;
|
||||
d.workOrderItemId = WorkOrderItem1Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
@@ -92,14 +92,14 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderItemLaborId1 = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
dynamic dLaborOne = a.ObjectResponse["data"];
|
||||
|
||||
//TWO
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitemlabor2 The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitemlabor2 test wiki";
|
||||
d.workOrderItemId = WorkOrderItemId;
|
||||
d.workOrderItemId = WorkOrderItem1Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
@@ -112,7 +112,106 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderItemLaborId2 = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
#endregion create first woitem
|
||||
|
||||
#region CREATE Second woitem
|
||||
/////////////////////////////////////////
|
||||
// Second woitem
|
||||
//
|
||||
|
||||
//CREATE WOITEM-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitem The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitem test wiki";
|
||||
d.workOrderId = WorkOrderId;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
dTagsArray.Add("woitem-Red");
|
||||
dTagsArray.Add("woitem-green");
|
||||
dTagsArray.Add("woitem-blue");
|
||||
d.tags = dTagsArray;
|
||||
|
||||
a = await Util.PostAsync("workorders/items", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderItem2Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
//CREATE WOITEMPART-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitempart The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitempart test wiki";
|
||||
d.workOrderItemId = WorkOrderItem2Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
dTagsArray.Add("woitempart-Red");
|
||||
dTagsArray.Add("woitempart-green");
|
||||
dTagsArray.Add("woitempart-blue");
|
||||
d.tags = dTagsArray;
|
||||
|
||||
a = await Util.PostAsync("workorders/items/parts", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
//CREATE WOITEMLABOR(S)-2
|
||||
|
||||
//ONE-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitemlabor The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitemlabor test wiki";
|
||||
d.workOrderItemId = WorkOrderItem2Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
dTagsArray.Add("woitemlabor-Red");
|
||||
dTagsArray.Add("woitemlabor-green");
|
||||
dTagsArray.Add("woitemlabor-blue");
|
||||
d.tags = dTagsArray;
|
||||
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//TWO-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "woitemlabor2 The quick brown fox jumped over the six lazy dogs!";
|
||||
d.wiki = "# woitemlabor2 test wiki";
|
||||
d.workOrderItemId = WorkOrderItem2Id;
|
||||
|
||||
//Tags
|
||||
dTagsArray = new JArray();
|
||||
dTagsArray.Add("woitemlabor-Red");
|
||||
dTagsArray.Add("woitemlabor-green");
|
||||
dTagsArray.Add("woitemlabor-blue");
|
||||
d.tags = dTagsArray;
|
||||
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
#endregion create second woitem
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//UPDATES
|
||||
//
|
||||
|
||||
dLaborOne.notes = "TestUpdateNotes";
|
||||
a = await Util.PutAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), dLaborOne.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//todo: update labor1
|
||||
//todo: update part1
|
||||
//todo: update woitem1
|
||||
//todo: update workorder
|
||||
|
||||
|
||||
|
||||
@@ -124,82 +223,84 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
a.ObjectResponse["data"]["notes"].Value<string>().Should().Be("WOHEADER The quick brown fox jumped over the six lazy dogs!");
|
||||
|
||||
/*
|
||||
{
|
||||
"data": {
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722459,
|
||||
"serial": 1,
|
||||
"active": true,
|
||||
"notes": "WOHEADER The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# WOHEADER test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"wo-red",
|
||||
"wo-green",
|
||||
"wo-blue"
|
||||
],
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722472,
|
||||
"notes": "woitem The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitem test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitem-red",
|
||||
"woitem-green",
|
||||
"woitem-blue"
|
||||
],
|
||||
"workOrderId": 1,
|
||||
"labors": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722486,
|
||||
"notes": "woitemlabor The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitemlabor test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitemlabor-red",
|
||||
"woitemlabor-green",
|
||||
"woitemlabor-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"concurrencyToken": 8722493,
|
||||
"notes": "woitemlabor2 The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitemlabor2 test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitemlabor-red",
|
||||
"woitemlabor-green",
|
||||
"woitemlabor-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
}
|
||||
],
|
||||
"parts": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722479,
|
||||
"notes": "woitempart The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitempart test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitempart-red",
|
||||
"woitempart-green",
|
||||
"woitempart-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
//todo: confirm entire graph exists by checking each level
|
||||
|
||||
/*
|
||||
{
|
||||
"data": {
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722459,
|
||||
"serial": 1,
|
||||
"active": true,
|
||||
"notes": "WOHEADER The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# WOHEADER test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"wo-red",
|
||||
"wo-green",
|
||||
"wo-blue"
|
||||
],
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722472,
|
||||
"notes": "woitem The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitem test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitem-red",
|
||||
"woitem-green",
|
||||
"woitem-blue"
|
||||
],
|
||||
"workOrderId": 1,
|
||||
"labors": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722486,
|
||||
"notes": "woitemlabor The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitemlabor test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitemlabor-red",
|
||||
"woitemlabor-green",
|
||||
"woitemlabor-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"concurrencyToken": 8722493,
|
||||
"notes": "woitemlabor2 The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitemlabor2 test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitemlabor-red",
|
||||
"woitemlabor-green",
|
||||
"woitemlabor-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
}
|
||||
],
|
||||
"parts": [
|
||||
{
|
||||
"id": 1,
|
||||
"concurrencyToken": 8722479,
|
||||
"notes": "woitempart The quick brown fox jumped over the six lazy dogs!",
|
||||
"wiki": "# woitempart test wiki",
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"woitempart-red",
|
||||
"woitempart-green",
|
||||
"woitempart-blue"
|
||||
],
|
||||
"workOrderItemId": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// //UPDATE
|
||||
@@ -216,6 +317,9 @@ namespace raven_integration
|
||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
||||
// uint concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//todo: delete extra labor
|
||||
//todo: delete woitem
|
||||
//todo: delete wo outright
|
||||
|
||||
// //DELETE
|
||||
// a = await Util.DeleteAsync("WorkOrder/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
|
||||
Reference in New Issue
Block a user