From e9e0991177c5b43ec0ab3c2c39c2cf67aaf4b33b Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 10 May 2020 23:54:16 +0000 Subject: [PATCH] --- WorkOrder/WorkOrderCrud.cs | 143 +++---------------------------------- 1 file changed, 11 insertions(+), 132 deletions(-) diff --git a/WorkOrder/WorkOrderCrud.cs b/WorkOrder/WorkOrderCrud.cs index 09d23e1..db9d248 100644 --- a/WorkOrder/WorkOrderCrud.cs +++ b/WorkOrder/WorkOrderCrud.cs @@ -224,6 +224,8 @@ namespace raven_integration #endregion update + + #region Validate all create and update //RETRIEVE WORKORDER AND VALIDATE ENTIRE @@ -270,143 +272,20 @@ namespace raven_integration #endregion delete - - } +// ApiResponse a = await Util.GetAsync("BuildMode"); +// Util.ValidateDataReturnResponseOk(a); +// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); +// BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" })); -//INTEGRATION_DELETE_TEST_FAIL_BEFORE_COMMIT in wo notes will fail delete immediately before transaction commit - - - // /// - // /// Test not found - // /// - // [Fact] - // public async void GetNonExistentItemShouldError() - // { - // //Get non existant - // //Should return status code 404, api error code 2010 - // ApiResponse a = await Util.GetAsync("WorkOrder/999999", await Util.GetTokenAsync("manager", "l3tm3in")); - // Util.ValidateResponseNotFound(a); - // } - - // /// - // /// Test bad modelstate - // /// - // [Fact] - // public async void GetBadModelStateShouldError() - // { - // //Get non existant - // //Should return status code 400, api error code 2200 and a first target in details of "id" - // ApiResponse a = await Util.GetAsync("WorkOrder/2q2", await Util.GetTokenAsync("manager", "l3tm3in")); - // Util.ValidateBadModelStateResponse(a, "id"); - // } - - - // /// - // /// Test server exception - // /// - // [Fact] - // public async void ServerExceptionShouldErrorPropertly() - // { - // //Get non existant - // //Should return status code 400, api error code 2200 and a first target in details of "id" - // ApiResponse a = await Util.GetAsync("WorkOrder/exception", await Util.GetTokenAsync("manager", "l3tm3in")); - // Util.ValidateServerExceptionResponse(a); - // } - - - - // /// - // /// Test server alt exception - // /// - // [Fact] - // public async void ServerAltExceptionShouldErrorPropertly() - // { - // //Get non existant - // //Should return status code 400, api error code 2200 and a first target in details of "id" - // ApiResponse a = await Util.GetAsync("WorkOrder/altexception", await Util.GetTokenAsync("manager", "l3tm3in")); - // Util.ValidateServerExceptionResponse(a); - // } - - - - - // /// - // /// - // /// - // [Fact] - // public async void PutConcurrencyViolationShouldFail() - // { - - // //CREATE - - // dynamic w2 = new JObject(); - // w2.name = Util.Uniquify("PutConcurrencyViolationShouldFail"); - // w2.dollarAmount = 2.22m; - // w2.active = true; - // w2.usertype = 1; - - // w2.notes = "blah"; - // w2.customFields = Util.WorkOrderRequiredCustomFieldsJsonString(); - - - // ApiResponse r2 = await Util.PostAsync("WorkOrder", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString()); - // Util.ValidateDataReturnResponseOk(r2); - // long w2Id = r2.ObjectResponse["data"]["id"].Value(); - // uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); - - - - // //UPDATE - // //PUT - - // w2.name = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATE VIA PUT "); - - // w2.concurrencyToken = OriginalConcurrencyToken - 1;//bad token - // ApiResponse PUTTestResponse = await Util.PutAsync("WorkOrder/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString()); - // Util.ValidateConcurrencyError(PUTTestResponse); - - - // } - - - - - // /// - // /// - // /// - // [Fact] - // public async void PatchConcurrencyViolationShouldFail() - // { - - // //CREATE - - // dynamic w2 = new JObject(); - // w2.name = Util.Uniquify("PatchConcurrencyViolationShouldFail"); - // w2.notes = "blah"; - // w2.customFields = Util.WorkOrderRequiredCustomFieldsJsonString(); - // w2.dollarAmount = 2.22m; - // w2.active = true; - // w2.usertype = 1; - // w2.customFields = Util.WorkOrderRequiredCustomFieldsJsonString(); - - // ApiResponse r2 = await Util.PostAsync("WorkOrder", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString()); - // Util.ValidateDataReturnResponseOk(r2); - // long w2Id = r2.ObjectResponse["data"]["id"].Value(); - // uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); - - - // //PATCH - // var newName = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATED VIA PATCH"); - // string patchJson = "[{\"value\": \"" + newName + "\",\"path\": \"/name\",\"op\": \"replace\"}]"; - // ApiResponse PATCHTestResponse = await Util.PatchAsync("WorkOrder/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson); - // Util.ValidateConcurrencyError(PATCHTestResponse); - // } - - +// if (BuildMode == "DEBUG") +// { +// //INTEGRATION_DELETE_TEST_FAIL_BEFORE_COMMIT in wo notes will fail delete immediately before transaction commit +// } + //==================================================