This commit is contained in:
2018-11-30 20:58:46 +00:00
parent 06c4b76c17
commit 460d50109f
4 changed files with 110 additions and 52 deletions

View File

@@ -74,7 +74,7 @@ namespace raven_integration
ApiResponse a = await Util.GetAsync("Widget/FilterOptions", await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);
a.ObjectResponse["data"]["key"].Value<string>().Should().Be("Widget");
a.ObjectResponse["data"]["key"].Value<string>().Should().Be("widget");
((JArray)a.ObjectResponse["data"]["flds"]).Count.Should().Be(6);
a.ObjectResponse["data"]["flds"][2]["lt"].Value<string>().Should().Be("Price");

View File

@@ -10,7 +10,7 @@ namespace raven_integration
public class WidgetValidationTest
{
/// <summary>
/// Test business rule should be active on new
/// </summary>
@@ -26,7 +26,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
Util.ValidateErrorCodeResponse(a, 2200, 400);
Util.ShouldContainValidationError(a, "Active", "InvalidValue");
@@ -51,11 +51,11 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
Util.ValidateDataReturnResponseOk(a);
//Now try to create again with same name
a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
Util.ValidateErrorCodeResponse(a, 2200, 400);
@@ -80,7 +80,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
@@ -104,7 +104,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
@@ -113,34 +113,6 @@ namespace raven_integration
}
/// <summary>
///
/// </summary>
[Fact]
public async void BusinessRuleOwnerIdMustExistOnUpdate()
{
//CREATE attempt with broken rules
dynamic d = new JObject();
d.name = Util.Uniquify("BusinessRuleOwnerIdMustExistOnUpdate TEST WIDGET");
d.created = DateTime.Now.ToString();
d.dollarAmount = 1.11m;
d.active = true;
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
Util.ValidateDataReturnResponseOk(a);
long Id = a.ObjectResponse["data"]["id"].Value<long>();
//Now put a change with no ownerId set
d.active = false;
a = await Util.PutAsync("Widget/" + Id.ToString(), await Util.GetTokenAsync( "InventoryFull"), d.ToString());
//2002 in-valid expected
Util.ValidateErrorCodeResponse(a, 2200, 400);
Util.ShouldContainValidationError(a, "OwnerId", "RequiredPropertyEmpty");
}
@@ -161,7 +133,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
@@ -189,7 +161,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
@@ -217,7 +189,7 @@ namespace raven_integration
d.roles = 0;
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected
@@ -245,7 +217,7 @@ namespace raven_integration
d.roles = 99999;//<---BAD ROLE VALUE
//create via inventory full test user
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), d.ToString());
//2002 in-valid expected