This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using FluentAssertions;
|
||||
@@ -33,6 +33,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
dynamic WorkorderToUpdate = a.ObjectResponse["data"];
|
||||
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
#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());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
dynamic dPartToUpdate = a.ObjectResponse["data"];
|
||||
long PartId = (long)a.ObjectResponse["data"]["id"];
|
||||
|
||||
|
||||
//CREATE WOITEMLABOR(S)
|
||||
@@ -96,6 +98,7 @@ namespace raven_integration
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
dynamic dLaborOne = a.ObjectResponse["data"];
|
||||
long Labor1Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//TWO
|
||||
d = new JObject();
|
||||
@@ -215,101 +218,31 @@ namespace raven_integration
|
||||
a = await Util.PutAsync("workorders/items", await Util.GetTokenAsync("manager", "l3tm3in"), WorkOrderItemToUpdate.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
|
||||
//todo: update labor1
|
||||
//todo: update part1
|
||||
//todo: update woitem1
|
||||
//todo: update workorder
|
||||
WorkorderToUpdate.notes = "UpdatedWoNotes";
|
||||
a = await Util.PutAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), WorkorderToUpdate.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
|
||||
|
||||
//RETRIEVE
|
||||
|
||||
//Get one
|
||||
//RETRIEVE WORKORDER AND VALIDATE ENTIRE
|
||||
a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
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
|
||||
|
||||
/*
|
||||
{
|
||||
"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
|
||||
|
||||
10
util.cs
10
util.cs
@@ -53,7 +53,7 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
// public static ConcurrentDictionary<string, string> authDict = new ConcurrentDictionary<string, string>();//10,32
|
||||
// public static ConcurrentDictionary<string, string> authDict = new ConcurrentDictionary<string, string>();//10,32
|
||||
|
||||
private static AutoId Auto { get; } = new AutoId(0);
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace raven_integration
|
||||
|
||||
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)
|
||||
// password = login;
|
||||
|
||||
@@ -644,5 +644,11 @@ namespace raven_integration
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
|
||||
Reference in New Issue
Block a user