This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@@ -33,6 +33,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
ApiResponse a = await Util.PostAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
ApiResponse a = await Util.PostAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
dynamic WorkorderToUpdate = a.ObjectResponse["data"];
|
||||||
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
#region CREATE first woitem
|
#region CREATE first woitem
|
||||||
@@ -76,6 +77,7 @@ namespace raven_integration
|
|||||||
a = await Util.PostAsync("workorders/items/parts", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
a = await Util.PostAsync("workorders/items/parts", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
dynamic dPartToUpdate = a.ObjectResponse["data"];
|
dynamic dPartToUpdate = a.ObjectResponse["data"];
|
||||||
|
long PartId = (long)a.ObjectResponse["data"]["id"];
|
||||||
|
|
||||||
|
|
||||||
//CREATE WOITEMLABOR(S)
|
//CREATE WOITEMLABOR(S)
|
||||||
@@ -96,6 +98,7 @@ namespace raven_integration
|
|||||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
dynamic dLaborOne = a.ObjectResponse["data"];
|
dynamic dLaborOne = a.ObjectResponse["data"];
|
||||||
|
long Labor1Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
//TWO
|
//TWO
|
||||||
d = new JObject();
|
d = new JObject();
|
||||||
@@ -215,101 +218,31 @@ namespace raven_integration
|
|||||||
a = await Util.PutAsync("workorders/items", await Util.GetTokenAsync("manager", "l3tm3in"), WorkOrderItemToUpdate.ToString());
|
a = await Util.PutAsync("workorders/items", await Util.GetTokenAsync("manager", "l3tm3in"), WorkOrderItemToUpdate.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
WorkorderToUpdate.notes = "UpdatedWoNotes";
|
||||||
|
a = await Util.PutAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), WorkorderToUpdate.ToString());
|
||||||
//todo: update labor1
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
//todo: update part1
|
|
||||||
//todo: update woitem1
|
|
||||||
//todo: update workorder
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//RETRIEVE
|
//RETRIEVE WORKORDER AND VALIDATE ENTIRE
|
||||||
|
|
||||||
//Get one
|
|
||||||
a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
a.ObjectResponse["data"]["notes"].Value<string>().Should().Be("WOHEADER The quick brown fox jumped over the six lazy dogs!");
|
|
||||||
|
var w = a.ObjectResponse["data"];
|
||||||
|
((string)w["notes"]).Should().Be("UpdatedWoNotes");
|
||||||
|
|
||||||
|
var woitem1 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem1Id);
|
||||||
|
((string)woitem1["notes"]).Should().Be("UpdatedWoItemNotes");
|
||||||
|
|
||||||
|
((string)woitem1["labors"].FirstOrDefault(z => (long)z["id"] == Labor1Id)["notes"]).Should().Be("UpdatedLaborNotes");
|
||||||
|
((string)woitem1["parts"].FirstOrDefault(z => (long)z["id"] == PartId)["notes"]).Should().Be("UpdatedPartNotes");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//todo: confirm entire graph exists by checking each level
|
//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
|
// //UPDATE
|
||||||
|
|||||||
8
util.cs
8
util.cs
@@ -86,7 +86,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
public async static Task<string> GetTokenAsync(string login, string password = null)
|
public async static Task<string> GetTokenAsync(string login, string password = null)
|
||||||
{
|
{
|
||||||
return await CredRepo.GetTokenAsync(login,password);
|
return await CredRepo.GetTokenAsync(login, password);
|
||||||
// if (password == null)
|
// if (password == null)
|
||||||
// password = login;
|
// password = login;
|
||||||
|
|
||||||
@@ -644,5 +644,11 @@ namespace raven_integration
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
|
|||||||
Reference in New Issue
Block a user