public void TestSearchOptionAliasLevelCount(ValidOptionAlias optionAlias, int optionLevel, OptionCount optionCount) { OptionManager optionHandler = new OptionManager(); string expectedAlias = ValidAliasMapper[optionAlias]; var response = optionHandler.SearchOption(expectedAlias, level: optionLevel, count: ValidCountMapper[optionCount]); PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(response.Result, PrIs.Not.Null.And.Not.Empty); PrAssert.That(response.Result.Select(r => r.Alias), Has.Exactly(1).EqualTo(expectedAlias), "The expected option cannot be found!"); }
public void TestSearchOptionAliasInvalidSelf(ValidOptionAlias optionAlias, InvalidOptionSelf optionSelf) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>() { ["alias"] = ValidAliasMapper[optionAlias], ["self"] = InvalidSelfMapper[optionSelf], }; 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 alias = {optionAlias.ToString()} and self = {optionSelf.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()}"); }
public void TestSearchOptionAliasSelf(ValidOptionAlias optionAlias, bool optionSelf) { OptionManager optionHandler = new OptionManager(); string expectedAlias = ValidAliasMapper[optionAlias]; var response = optionHandler.SearchOption(expectedAlias, self: optionSelf); PrAssert.That(response, PrIs.SuccessfulResponse()); if (optionSelf) { PrAssert.That(response.Result, PrIs.Not.Null.And.Not.Empty); PrAssert.That(response.Result.Select(r => r.Alias), Has.Exactly(1).EqualTo(expectedAlias), "The expected option cannot be found!"); } else { PrAssert.That(response.Result, PrIs.Not.Null.And.Not.Empty); PrAssert.That(response.Result.SingleOrDefault(), Has.Count.EqualTo(0), "The prepared option is found although self = false!"); } }