public void TestSearchOptionId(ValidOptionId optionId) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>(RequestOptionSearch); ValidIdMapper[optionId](requestDic, OptionCreator.Data.Id); var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(response.Result, PrIs.Not.Null.And.Not.Empty); PrAssert.That(response.Result.Select(r => r.Id), Has.Exactly(1).EqualTo(OptionCreator.Data.Id), "The expected option cannot be found!"); }
public void TestSearchOptionInvalidSelf(ValidOptionId optionId, InvalidOptionSelf optionSelf) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>() { ["self"] = InvalidSelfMapper[optionSelf], }; ValidIdMapper[optionId](requestDic, OptionCreater.Data.Id); var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidValue), $"Still able to search option with both id = {optionId.ToString()} and self = {optionSelf.ToString()}"); }
public void TestSearchOptionInvalidLevel(ValidOptionId optionId, InvalidOptionLevel optionLevel) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>() { ["level"] = InvalidLevelMapper[optionLevel], }; ValidIdMapper[optionId](requestDic, OptionCreater.Data.Id); var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidValue).Or.ErrorCode((int)ResultCode.ValueRangeExceeded), $"Still able to search option with both id = {optionId.ToString()} and level = {optionLevel.ToString()}"); }
public void TestSearchOptionIdAlias(ValidOptionId optionId, ValidOptionAlias optionAlias) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>() { ["alias"] = ValidAliasMapper[optionAlias], }; ValidIdMapper[optionId](requestDic, OptionCreater.Data.Id); var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidParameter), $"Still able to search option with both id = {optionId.ToString()} and alias = {optionAlias.ToString()}"); }