public void CreateValidOption(RequestType requestType, OptionNestingType optionNestingType, ValidOptionCases inputType) { WriteAndVerifyOption(requestType, optionNestingType, inputType); }
public void UpdateValidOption(RequestType requestType, OptionNestingType optionNestingType, ValidOptionCases inputType) { WriteAndVerifyOption(requestType, optionNestingType, inputType, optionNestingType == OptionNestingType.Parent ? Common.GetOptionsByCurrentContext("parentOptionCreateResponse") : Common.GetOptionsByCurrentContext("childOptionCreateResponse")); }
/// <summary> /// Create/Update a child/parent option /// </summary> /// <param name="requestType">Request type</param> /// <param name="optionNestingType">Child/Parent</param> /// <param name="inputType">Test case</param> /// <param name="options">options == null : 'create' ? 'update'</param> private static void WriteAndVerifyOption(RequestType requestType, OptionNestingType optionNestingType, ValidOptionCases inputType, List <OptionWriteResponse> options = null) { string valueInput = OptionData.ValidOptionMapper[inputType].ToString(); int numberOfOptions = RequestType.Multiple == requestType ? NumberOfOptions : 0; switch (inputType) { case ValidOptionCases.Id: WriteAndVerifyOptionById(numberOfOptions, optionNestingType, int.Parse(valueInput), options); break; case ValidOptionCases.ParentIdZero: WriteAndVerifyOptionByParentId(numberOfOptions, optionNestingType, int.Parse(valueInput), options); break; case ValidOptionCases.ParentIdExisted: int parentId = Common.GetOptionsByCurrentContext("parentOptionCreateResponse").FirstOrDefault().Id; WriteAndVerifyOptionByParentId(numberOfOptions, optionNestingType, parentId, options); break; case ValidOptionCases.NameBasicLatin: case ValidOptionCases.NameCyrillic: case ValidOptionCases.NameHiragana: case ValidOptionCases.NameKanji: case ValidOptionCases.NameMaxLength: case ValidOptionCases.NameKatakana: WriteAndVerifyOptionByName(numberOfOptions, optionNestingType, valueInput, options); break; case ValidOptionCases.SortZero: case ValidOptionCases.SortOne: WriteAndVerifyOptionBySort(numberOfOptions, optionNestingType, int.Parse(valueInput), options); break; case ValidOptionCases.EnabledZero: case ValidOptionCases.EnabledOne: WriteAndVerifyOptionByEnabled(numberOfOptions, optionNestingType, int.Parse(valueInput), options); break; default: //Type WriteAndVerifyOptionByType(numberOfOptions, optionNestingType, int.Parse(valueInput), options); break; } }