4648
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using FluentAssertions;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
|
|
||||||
namespace raven_integration
|
namespace raven_integration
|
||||||
{
|
{
|
||||||
@@ -19,14 +15,14 @@ namespace raven_integration
|
|||||||
// {
|
// {
|
||||||
// //CREATE attempt with broken rules
|
// //CREATE attempt with broken rules
|
||||||
// dynamic d = new JObject();
|
// dynamic d = new JObject();
|
||||||
// d.name = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToDeleteNonOwned TEST WIDGET");
|
// d.name = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToDeleteNonOwned TEST PROJECT");
|
||||||
// d.created = DateTime.Now.ToString();
|
// d.created = DateTime.Now.ToString();
|
||||||
// d.dollarAmount = 1.11m;
|
// 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;
|
// 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.ValidateErrorCodeResponse(a, 2200, 400);
|
||||||
// Util.ShouldContainValidationError(a, "Active", "2203");
|
// Util.ShouldContainValidationError(a, "Active", "2203");
|
||||||
@@ -44,20 +40,19 @@ namespace raven_integration
|
|||||||
{
|
{
|
||||||
//CREATE attempt with broken rules
|
//CREATE attempt with broken rules
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.name = Util.Uniquify("BusinessRuleNameMustBeUnique TEST WIDGET");
|
d.name = Util.Uniquify("BusinessRuleNameMustBeUnique TEST PROJECT");
|
||||||
d.notes = "blah";
|
d.notes = "blah";
|
||||||
d.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
|
||||||
d.created = DateTime.Now.ToString();
|
d.created = DateTime.Now.ToString();
|
||||||
d.dollarAmount = 1.11m;
|
d.dollarAmount = 1.11m;
|
||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = 1;
|
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);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
//Now try to create again with same name
|
//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
|
//2002 in-valid expected
|
||||||
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
||||||
@@ -81,8 +76,8 @@ namespace raven_integration
|
|||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = 1;
|
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
|
//2002 in-valid expected
|
||||||
@@ -93,37 +88,12 @@ namespace raven_integration
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[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");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")]
|
||||||
public async Task BusinessRuleStartDateWithoutEndDateShouldError()
|
public async Task BusinessRuleStartDateWithoutEndDateShouldError()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -136,8 +106,8 @@ namespace raven_integration
|
|||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = 1;
|
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
|
//2002 in-valid expected
|
||||||
@@ -151,7 +121,7 @@ namespace raven_integration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")]
|
||||||
public async Task BusinessRuleEndDateWithoutStartDateShouldError()
|
public async Task BusinessRuleEndDateWithoutStartDateShouldError()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -164,8 +134,8 @@ namespace raven_integration
|
|||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = 1;
|
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
|
//2002 in-valid expected
|
||||||
@@ -178,7 +148,7 @@ namespace raven_integration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact(Skip = "TODO: Implement after workorder tests working needs dated object to test")]
|
||||||
public async Task BusinessRuleEndDateBeforeStartDateShouldError()
|
public async Task BusinessRuleEndDateBeforeStartDateShouldError()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -192,8 +162,8 @@ namespace raven_integration
|
|||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = 1;
|
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
|
//2002 in-valid expected
|
||||||
@@ -214,19 +184,9 @@ namespace raven_integration
|
|||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.name = Util.Uniquify("BusinessRuleEnumInvalidShouldError TEST");
|
d.name = Util.Uniquify("BusinessRuleEnumInvalidShouldError TEST");
|
||||||
d.created = DateTime.Now.ToString();
|
d.created = DateTime.Now.ToString();
|
||||||
|
|
||||||
//NO END DATE ERRROR
|
|
||||||
d.dollarAmount = 1.11m;
|
|
||||||
d.active = true;
|
d.active = true;
|
||||||
d.usertype = -1;//<---BAD VALUE
|
d.usertype = -1;//<---BAD VALUE
|
||||||
d.Notes = "blah";
|
ApiResponse a = await Util.PostAsync("user", await Util.GetTokenAsync("BizAdmin"), d.ToString());
|
||||||
d.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
|
||||||
|
|
||||||
|
|
||||||
//create via inventory full test user
|
|
||||||
ApiResponse a = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), d.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
//2002 in-valid expected
|
//2002 in-valid expected
|
||||||
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
||||||
Util.ShouldContainValidationError(a, "UserType", "2203");
|
Util.ShouldContainValidationError(a, "UserType", "2203");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ namespace raven_integration
|
|||||||
public class WorkOrderCrud
|
public class WorkOrderCrud
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test all CRUD routes for a WorkOrder
|
/// Test all CRUD routes for a WorkOrder
|
||||||
/// Build up graph, update graph, remove graph bit by bit
|
/// Build up graph, update graph, remove graph bit by bit
|
||||||
|
|||||||
Reference in New Issue
Block a user