public void CreateOptionInvalidAlias(OptionAliasData.InvalidOptionAlias invalidType) { var optionHandler = new OptionManager(); var requestDic = new Dictionary <string, object>(OptionAliasData.GetOptionRequestDictionary($"my option {invalidType.ToString()}")) { ["alias"] = OptionAliasData.InvalidAliasMapper[invalidType], ["children"] = new List <Dictionary <string, object> > { OptionAliasData.GetOptionRequestDictionary($"my option {invalidType.ToString()} child") }, }; var result = optionHandler.CreateOption(requestDic); if (result.IsSuccess) { OptionCleaner.DeleteMany(new List <int>() { result.Result.Single().Children.Single().Id, result.Result.Single().Id }); } if (invalidType == OptionAliasData.InvalidOptionAlias.ExistedAlias || invalidType == OptionAliasData.InvalidOptionAlias.ExistedAliasLowerCase || invalidType == OptionAliasData.InvalidOptionAlias.ExistedAliasUpperCase) { PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.Conflict).And.ErrorCode((int)ResultCode.DataExists), "Create Option Successfully"); } else { PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidFormat), "Create Option Successfully"); } }
public void UpdateOptionInvalidAlias(OptionAliasData.InvalidOptionAlias invalidType) { var optionHandler = new OptionManager(); var updateRequest = new Dictionary <string, object>() { ["alias"] = OptionAliasData.InvalidAliasMapper[invalidType], ["children"] = new List <Dictionary <string, object> > { OptionAliasData.GetOptionRequestDictionary($"my option {invalidType.ToString()} child", OptionCreater.Data.Children.Single().Id) }, }; var updateResult = optionHandler.UpdateOption(OptionCreater.Data.Id, updateRequest); PrAssert.That(updateResult, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidParameter), "Update Option Successfully"); }