From b7adb7dae9e4ed6ab11f235474903dc53dc045cb Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 26 Feb 2026 11:42:55 -0800 Subject: [PATCH] 4648 --- BusinessRules/CommonValidation.cs | 80 ++++++++----------------------- WorkOrder/WorkOrderCrud.cs | 4 ++ 2 files changed, 24 insertions(+), 60 deletions(-) diff --git a/BusinessRules/CommonValidation.cs b/BusinessRules/CommonValidation.cs index 1f06af4..b6718d8 100644 --- a/BusinessRules/CommonValidation.cs +++ b/BusinessRules/CommonValidation.cs @@ -1,9 +1,5 @@ -using System; using Xunit; using Newtonsoft.Json.Linq; -using FluentAssertions; -using System.Collections.Generic; -using System.Collections.Concurrent; namespace raven_integration { @@ -19,14 +15,14 @@ namespace raven_integration // { // //CREATE attempt with broken rules // dynamic d = new JObject(); - // d.name = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToDeleteNonOwned TEST WIDGET"); + // d.name = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToDeleteNonOwned TEST PROJECT"); // d.created = DateTime.Now.ToString(); // d.dollarAmount = 1.11m; - // d.active = false;//<--- BROKEN RULE new widget must be active = true!! + // d.active = false;//<--- BROKEN RULE new project must be active = true!! // d.usertype = 1; - // //create via inventory full test user - // ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + // + // ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("Inventory"), d.ToString()); // Util.ValidateErrorCodeResponse(a, 2200, 400); // Util.ShouldContainValidationError(a, "Active", "2203"); @@ -44,20 +40,19 @@ namespace raven_integration { //CREATE attempt with broken rules dynamic d = new JObject(); - d.name = Util.Uniquify("BusinessRuleNameMustBeUnique TEST WIDGET"); + d.name = Util.Uniquify("BusinessRuleNameMustBeUnique TEST PROJECT"); d.notes = "blah"; - d.customFields = Util.WidgetRequiredCustomFieldsJsonString(); d.created = DateTime.Now.ToString(); d.dollarAmount = 1.11m; d.active = true; d.usertype = 1; - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + + ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); Util.ValidateDataReturnResponseOk(a); //Now try to create again with same name - a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected Util.ValidateErrorCodeResponse(a, 2200, 400); @@ -81,8 +76,8 @@ namespace raven_integration d.active = true; d.usertype = 1; - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + + ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected @@ -93,37 +88,12 @@ namespace raven_integration } - /// - /// - /// - [Fact] - public async Task BusinessRuleNameLengthExceeded() - { - - dynamic d = new JObject(); - d.name = new string('A', 256); ; - d.created = DateTime.Now.ToString(); - d.dollarAmount = 1.11m; - d.active = true; - d.usertype = 1; - - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); - - - //2002 in-valid expected - Util.ValidateErrorCodeResponse(a, 2200, 400); - Util.ShouldContainValidationError(a, "Name", "2202", "255 max"); - - } - - /// /// /// - [Fact] + [Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")] public async Task BusinessRuleStartDateWithoutEndDateShouldError() { @@ -136,8 +106,8 @@ namespace raven_integration d.active = true; d.usertype = 1; - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + + ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected @@ -151,7 +121,7 @@ namespace raven_integration /// /// /// - [Fact] + [Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")] public async Task BusinessRuleEndDateWithoutStartDateShouldError() { @@ -164,8 +134,8 @@ namespace raven_integration d.active = true; d.usertype = 1; - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + + ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected @@ -178,7 +148,7 @@ namespace raven_integration /// /// /// - [Fact] + [Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")] public async Task BusinessRuleEndDateBeforeStartDateShouldError() { @@ -192,8 +162,8 @@ namespace raven_integration d.active = true; d.usertype = 1; - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); + + ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected @@ -214,19 +184,9 @@ namespace raven_integration dynamic d = new JObject(); d.name = Util.Uniquify("BusinessRuleEnumInvalidShouldError TEST"); d.created = DateTime.Now.ToString(); - - //NO END DATE ERRROR - d.dollarAmount = 1.11m; d.active = true; d.usertype = -1;//<---BAD VALUE - d.Notes = "blah"; - d.customFields = Util.WidgetRequiredCustomFieldsJsonString(); - - - //create via inventory full test user - ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString()); - - + ApiResponse a = await Util.PostAsync("user", await Util.GetTokenAsync("BizAdmin"), d.ToString()); //2002 in-valid expected Util.ValidateErrorCodeResponse(a, 2200, 400); Util.ShouldContainValidationError(a, "UserType", "2203"); diff --git a/WorkOrder/WorkOrderCrud.cs b/WorkOrder/WorkOrderCrud.cs index 88ab6cf..e3f3ba9 100644 --- a/WorkOrder/WorkOrderCrud.cs +++ b/WorkOrder/WorkOrderCrud.cs @@ -9,6 +9,10 @@ namespace raven_integration public class WorkOrderCrud { + + + + /// /// Test all CRUD routes for a WorkOrder /// Build up graph, update graph, remove graph bit by bit