public void ValidGetCustomActionTest(CustomActionTestData.ValidUrl url, CustomActionTestData.ValidLabel validLabel, CustomActionTestData.ValidLabelValue validLabelValue, CustomActionTestData.ValidPlaceValue validPlaceValue) { var createRequest = CreateCustomActionTests.GetCreateRequest(CustomActionTestData.ValidUrlMapper[url], CustomActionTestData.ValidLabelMapper[validLabel](CustomActionTestData.ValidLabelValueMapper[validLabelValue]), CustomActionTestData.ValidPlaceValueMapper[validPlaceValue]); var hanlder = new CustomActionManager(); var response = hanlder.CustomAction <CreateCustomActionResponse>(createRequest, HttpMethod.POST.ToNetHttpMethod()); if (validLabel == CustomActionTestData.ValidLabel.BothEnJa) { PrAssume.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not create custom action"); var allCustomAction = hanlder.GetAllCustomActions(); CreateCustomActionTests.DeleteCustomAction(response.Result.Id); PrAssert.That(allCustomAction.Result[response.Result.Id].Url, PrIs.EqualTo(CustomActionTestData.ValidUrlMapper[url]), "The url is not as expected"); PrAssert.That(allCustomAction.Result[response.Result.Id].Label.EnUs.Value, PrIs.EqualTo(CustomActionTestData.ValidLabelValueMapper[validLabelValue][CustomActionTestData.ValueParam]), "The En label value is not as expected"); PrAssert.That(allCustomAction.Result[response.Result.Id].Label.Ja.Value, PrIs.EqualTo(CustomActionTestData.ValidLabelValueMapper[validLabelValue][CustomActionTestData.ValueParam]), "The Ja label value is not as expected"); if (validLabelValue != CustomActionTestData.ValidLabelValue.MissingDefaultStringWithSpace && validLabelValue != CustomActionTestData.ValidLabelValue.MissingDefaultStringNoSpace) { PrAssert.That(allCustomAction.Result[response.Result.Id].Label.Ja.Default, PrIs.EqualTo(CustomActionTestData.ValidLabelValueMapper[validLabelValue][CustomActionTestData.DefaultParam]), "The Ja label default is not as expected"); PrAssert.That(allCustomAction.Result[response.Result.Id].Label.EnUs.Default, PrIs.EqualTo(CustomActionTestData.ValidLabelValueMapper[validLabelValue][CustomActionTestData.DefaultParam]), "The En label default is not as expected"); } } else { PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Create custom action Successfully"); } }
public void ValidCreateCustomActionTest(CustomActionTestData.ValidUrl url, CustomActionTestData.ValidLabel validLabel, CustomActionTestData.ValidLabelValue validLabelValue, CustomActionTestData.ValidPlaceValue validPlaceValue) { var createRequest = GetCreateRequest(CustomActionTestData.ValidUrlMapper[url], CustomActionTestData.ValidLabelMapper[validLabel](CustomActionTestData.ValidLabelValueMapper[validLabelValue]), CustomActionTestData.ValidPlaceValueMapper[validPlaceValue]); var hanlder = new CustomActionManager(); var response = hanlder.CustomAction <CreateCustomActionResponse>(createRequest, HttpMethod.POST.ToNetHttpMethod()); if (validLabel == CustomActionTestData.ValidLabel.BothEnJa) { PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not create custom action"); PrAssert.That(response.Result.Id, PrIs.Not.Null.And.Not.Empty, "Can not create custom action"); var allCustomAction = hanlder.GetAllCustomActions(); PrAssert.That(allCustomAction.Result[response.Result.Id].Url, PrIs.EqualTo(CustomActionTestData.ValidUrlMapper[url]), "The url is not as expected"); DeleteCustomAction(response.Result.Id); } else { PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Create custom action successfully"); } }