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]
|
[Fact]
|
||||||
public async void ConfirmDeleteTransactionWorksAtServer()
|
public async void ConfirmDeleteTransactionWorksAtServer()
|
||||||
{
|
{
|
||||||
ApiResponse a = await Util.GetAsync("BuildMode");
|
ApiResponse a = await Util.GetAsync("BuildMode");
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
var BuildMode = (string)a.ObjectResponse["data"]["buildMode"];
|
||||||
BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" }));
|
|
||||||
|
|
||||||
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();
|
dynamic d = new JObject();
|
||||||
d.active = true;
|
d.active = true;
|
||||||
d.notes = "WOHEADER";
|
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
|
||||||
|
|
||||||
|
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);
|
||||||
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
long WorkOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//CREATE WOITEM 1
|
//CREATE WOITEM 1
|
||||||
d = new JObject();
|
d = new JObject();
|
||||||
d.active = true;
|
d.active = true;
|
||||||
@@ -320,7 +307,6 @@ namespace raven_integration
|
|||||||
d.workOrderItemId = WorkOrderItem1Id;
|
d.workOrderItemId = WorkOrderItem1Id;
|
||||||
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);
|
||||||
long PartId = (long)a.ObjectResponse["data"]["id"];
|
|
||||||
|
|
||||||
//CREATE TWO WOITEMLABORS
|
//CREATE TWO WOITEMLABORS
|
||||||
//ONE
|
//ONE
|
||||||
@@ -337,11 +323,6 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////
|
|
||||||
// Second woitem
|
|
||||||
//
|
|
||||||
|
|
||||||
//CREATE WOITEM-2
|
//CREATE WOITEM-2
|
||||||
d = new JObject();
|
d = new JObject();
|
||||||
d.active = true;
|
d.active = true;
|
||||||
@@ -350,17 +331,13 @@ namespace raven_integration
|
|||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long WorkOrderItem2Id = (long)a.ObjectResponse["data"]["id"];
|
long WorkOrderItem2Id = (long)a.ObjectResponse["data"]["id"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//CREATE WOITEMPART-2
|
//CREATE WOITEMPART-2
|
||||||
d = new JObject();
|
d = new JObject();
|
||||||
d.active = true;
|
d.active = true;
|
||||||
d.workOrderItemId = WorkOrderItem2Id;
|
d.workOrderItemId = WorkOrderItem2Id;
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
//CREATE WOITEMLABOR(S)-2
|
//CREATE WOITEMLABOR(S)-2
|
||||||
//ONE-2
|
//ONE-2
|
||||||
d = new JObject();
|
d = new JObject();
|
||||||
@@ -376,21 +353,24 @@ 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);
|
||||||
|
|
||||||
|
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"));
|
//now confirm the workorder is still there and with it's children intact
|
||||||
// Util.ValidateHTTPStatusCode(a, 204);
|
//RETRIEVE WORKORDER AND VALIDATE ENTIRE
|
||||||
// a = await Util.GetAsync("workorders/items/labors/" + Labor1Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
// Util.ValidateHTTPStatusCode(a, 404);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
// a = await Util.DeleteAsync("workorders/items/" + WorkOrderItem2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
var w = a.ObjectResponse["data"];
|
||||||
// Util.ValidateHTTPStatusCode(a, 204);
|
w["items"].Count().Should().Be(2);
|
||||||
// a = await Util.GetAsync("workorders/items/" + WorkOrderItem2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
|
||||||
// Util.ValidateHTTPStatusCode(a, 404);
|
|
||||||
|
|
||||||
// a = await Util.DeleteAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
var woitem1 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem1Id);
|
||||||
// Util.ValidateHTTPStatusCode(a, 204);
|
woitem1["labors"].Count().Should().Be(2);
|
||||||
// a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
woitem1["parts"].Count().Should().Be(1);
|
||||||
// Util.ValidateHTTPStatusCode(a, 404);
|
|
||||||
|
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