diff --git a/WorkOrder/WorkOrderCrud.cs b/WorkOrder/WorkOrderCrud.cs index 2693bbf..ebf1111 100644 --- a/WorkOrder/WorkOrderCrud.cs +++ b/WorkOrder/WorkOrderCrud.cs @@ -80,7 +80,7 @@ namespace raven_integration long PartId = (long)a.ObjectResponse["data"]["id"]; - //CREATE WOITEMLABOR(S) + //CREATE TWO WOITEMLABORS //ONE d = new JObject(); d.active = true; @@ -128,7 +128,7 @@ namespace raven_integration //CREATE WOITEM-2 d = new JObject(); d.active = true; - d.notes = "woitem The quick brown fox jumped over the six lazy dogs!"; + d.notes = "woitem-2"; d.wiki = "# woitem test wiki"; d.workOrderId = WorkOrderId; @@ -148,7 +148,7 @@ namespace raven_integration //CREATE WOITEMPART-2 d = new JObject(); d.active = true; - d.notes = "woitempart The quick brown fox jumped over the six lazy dogs!"; + d.notes = "woitem-2-part"; d.wiki = "# woitempart test wiki"; d.workOrderItemId = WorkOrderItem2Id; @@ -168,7 +168,7 @@ namespace raven_integration //ONE-2 d = new JObject(); d.active = true; - d.notes = "woitemlabor The quick brown fox jumped over the six lazy dogs!"; + d.notes = "woitem-2-labor The quick brown fox jumped over the six lazy dogs!"; d.wiki = "# woitemlabor test wiki"; d.workOrderItemId = WorkOrderItem2Id; @@ -185,7 +185,7 @@ namespace raven_integration //TWO-2 d = new JObject(); d.active = true; - d.notes = "woitemlabor2 The quick brown fox jumped over the six lazy dogs!"; + d.notes = "woitem-2-labor2 The quick brown fox jumped over the six lazy dogs!"; d.wiki = "# woitemlabor2 test wiki"; d.workOrderItemId = WorkOrderItem2Id; @@ -223,24 +223,29 @@ namespace raven_integration Util.ValidateDataReturnResponseOk(a); - - //RETRIEVE WORKORDER AND VALIDATE ENTIRE a = await Util.GetAsync("workorders/" + WorkOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); var w = a.ObjectResponse["data"]; + w["items"].Count().Should().Be(2); ((string)w["notes"]).Should().Be("UpdatedWoNotes"); - var woitem1 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem1Id); - ((string)woitem1["notes"]).Should().Be("UpdatedWoItemNotes"); + var woitem1 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem1Id); + woitem1["labors"].Count().Should().Be(2); + woitem1["parts"].Count().Should().Be(1); + ((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 + var woitem2 = w["items"].FirstOrDefault(z => (long)z["id"] == WorkOrderItem2Id); + woitem2["labors"].Count().Should().Be(2); + woitem2["parts"].Count().Should().Be(1); + ((string)woitem2["notes"]).Should().Be("woitem-2"); + woitem2["labors"].FirstOrDefault(z => (string)z["notes"] == "woitem-2-labor2 The quick brown fox jumped over the six lazy dogs!").Should().NotBeNull(); + woitem2["parts"].FirstOrDefault(z => (string)z["notes"] == "woitem-2-part").Should().NotBeNull(); + woitem2["parts"].FirstOrDefault(z => (string)z["notes"] == "bogus").Should().BeNull();