public void TestDuplicateParameters(ParametersBulkCreate parameter, Values value) { var handler = new BulkCreateManager(); var response = handler.BulkCreate <BulkUpdateResponse>(value == Values.Same ? DuplicateParametersSameValue[parameter] : DuplicateParametersNotSameValue[parameter], System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent)); }
public void TestBulkCreateWithFieldFromAnotherResource() { var handler = new BulkCreateManager(); var request = DefaultBulkCreateParameters(ResourceId.Client, "P_Position", "Test Position"); var response = handler.BulkCreate <object>(request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
public void TestWrongContentTypeBulkCreate() { var handler = new BulkCreateManager(); var response = handler.BulkCreate <object>(GetBulkCreateContent(Entries.Single, ResourceId.Client, new Dictionary <string, string> { ["P_Name"] = "Test Name" }, RecordsCreator), System.Net.Http.HttpMethod.Post, "html/text"); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
public void TestBulkCreateByOtherHttpMethod(HttpMethod inputType) { var handler = new BulkCreateManager(); var response = handler.BulkCreate <object>(GetBulkCreateContent(Entries.Single, ResourceId.Client, new Dictionary <string, string> { ["P_Name"] = "Test Name" }, RecordsCreator), inputType.ToNetHttpMethod()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound)); }
public void TestBulkCreateWithPhaseMissing(string fieldName, InputType inputType) { var handler = new BulkCreateManager(); string fieldValue = fieldValue = DefaultValueFieldTypes[inputType](RecordsCreator, ResourceId.Client, fieldName, null); var request = DefaultBulkCreateParameters(ResourceId.Client, fieldName, fieldValue); var response = handler.BulkCreate <BulkUpdateResponse>(request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK)); PrAssert.That(SearchHelpers.GetBulkUpdateQueueStatus(response.Result.Id.ToString(), WaitingTimeSecond, fieldName == Phase ? false : true), "Bulk create is unsuccessful."); }
public void TestBulkCreateInjection(ParametersBulkCreate parameter, InjectionInput inputType) { var handler = new BulkCreateManager(); var request = DefaultBulkCreateParameters(ResourceId.Client, "P_Name", "Test Name"); var valueInput = InjectionInputData.InjectionInputMapper[inputType]; request = GetRequestForBulkCreate(request, parameter, valueInput); var response = handler.BulkCreate <object>(request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
public void TestBulkCreateGenarateInvalid(ParametersBulkCreate parameter, InvalidTestCases inputType, System.Net.HttpStatusCode resultCode) { var handler = new BulkCreateManager(); var request = DefaultBulkCreateParameters(ResourceId.Client, "P_Name", "Test Name"); request = GetRequestForBulkCreate(request, parameter, InvalidMaps[inputType].ToString(), inputType); var response = handler.BulkCreate <BulkUpdateResponse>(request, System.Net.Http.HttpMethod.Post); if (resultCode == System.Net.HttpStatusCode.OK) { PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK)); } else { PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); } }
public void TestInvalidBodyJson(OriginalSearchHelpers.InvalidSpecialCondition inputType) { var handler = new BulkCreateManager(); var bulkCreateContentObject = GetBulkCreateContent(Entries.Single, ResourceId.Client, new Dictionary <string, string> { ["P_Name"] = "Test Name" }, RecordsCreator); string jsonContent = string.Empty; if (inputType == OriginalSearchHelpers.InvalidSpecialCondition.BrokenJsonFormat) { jsonContent = JsonConvert.SerializeObject(bulkCreateContentObject).ToString().Substring(1); } else { jsonContent = DashboardHelpers.InvalidBodyJsonTestCasesMapper[inputType].ToString(); } var response = handler.BulkCreate <object>(jsonContent, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }