This commit is contained in:
@@ -274,38 +274,25 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test all CRUD routes for a WorkOrder
|
||||
/// Build up graph, update graph, remove graph bit by bit
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void ConfirmDeleteTransactionWorksAtServer()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("BuildMode");
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" }));
|
||||
var BuildMode = (string)a.ObjectResponse["data"]["buildMode"];
|
||||
|
||||
if (BuildMode == "DEBUG")
|
||||
if (BuildMode == "DEBUG")//The key phrase that triggers exception during delete only exists in debug builds of server
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// CREATE
|
||||
//
|
||||
dynamic d = new JObject();
|
||||
d.active = true;
|
||||
d.notes = "WOHEADER";
|
||||
d.wiki = "INTEGRATION_DELETE_TEST_FAIL_BEFORE_COMMIT";
|
||||
d.wiki = "INTEGRATION_DELETE_TEST_FAIL_BEFORE_COMMIT";//<-- key phrase triggers server exception in Workorder immediately before it would normally commit the whole thing
|
||||
|
||||
|
||||
|
||||
ApiResponse a = await Util.PostAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
a = await Util.PostAsync("workorders", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
//CREATE WOITEM 1
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
@@ -320,7 +307,6 @@ namespace raven_integration
|
||||
d.workOrderItemId = WorkOrderItem1Id;
|
||||
a = await Util.PostAsync("workorders/items/parts", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long PartId = (long)a.ObjectResponse["data"]["id"];
|
||||
|
||||
//CREATE TWO WOITEMLABORS
|
||||
//ONE
|
||||
@@ -337,11 +323,6 @@ namespace raven_integration
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
// Second woitem
|
||||
//
|
||||
|
||||
//CREATE WOITEM-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
@@ -350,17 +331,13 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WorkOrderItem2Id = (long)a.ObjectResponse["data"]["id"];
|
||||
|
||||
|
||||
|
||||
//CREATE WOITEMPART-2
|
||||
d = new JObject();
|
||||
d.active = true;
|
||||
d.workOrderItemId = WorkOrderItem2Id;
|
||||
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();
|
||||
@@ -376,21 +353,24 @@ namespace raven_integration
|
||||
a = await Util.PostAsync("workorders/items/labors", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
a = await Util.DeleteAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateServerExceptionResponse(a);
|
||||
|
||||
// a = await Util.DeleteAsync("workorders/items/labors/" + Labor1Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.GetAsync("workorders/items/labors/" + Labor1Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 404);
|
||||
//now confirm the workorder is still there and with it's children intact
|
||||
//RETRIEVE WORKORDER AND VALIDATE ENTIRE
|
||||
a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
// a = await Util.DeleteAsync("workorders/items/" + WorkOrderItem2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.GetAsync("workorders/items/" + WorkOrderItem2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 404);
|
||||
var w = a.ObjectResponse["data"];
|
||||
w["items"].Count().Should().Be(2);
|
||||
|
||||
// a = await Util.DeleteAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 404);
|
||||
var woitem1 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem1Id);
|
||||
woitem1["labors"].Count().Should().Be(2);
|
||||
woitem1["parts"].Count().Should().Be(1);
|
||||
|
||||
var woitem2 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem2Id);
|
||||
woitem2["labors"].Count().Should().Be(2);
|
||||
woitem2["parts"].Count().Should().Be(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user