private static Func <ISession <PrivateAuthentication>, ITest, Task <OptionSearchResponse> > ReadOptions(string alias, int level) { return(async(session, test) => { return (await session.CallAsync((OptionSearchRequest.Builder()).AddName(alias).AddLevel(level.ToString()))); }); }
private static Func <ISession <PrivateAuthentication>, ITest, Task <OptionSearchResponse> > ReadOptions(List <string> aliasList, int level) { return(async(session, test) => { List <OptionJson.OptionSearchContent> result = new List <OptionJson.OptionSearchContent>(); foreach (var alias in aliasList) { var item = (await session.CallAsync((OptionSearchRequest.Builder()).AddName(alias).AddLevel(level.ToString()))); result.AddRange(item.Options); } return new OptionSearchResponse(result); }); }
public async Task SearchOption() { // create request var builer = OptionSearchRequest.Builder(); builer.AddName("Option.P_ClientContact").AddLevel(-1); //Get session using (var client = PrivateClient.CreateClient(new PrivateServerSettings() { ServerUrl = server, LoggerFactory = TestLoggerFactoryAttribute.CurrentLoggerFactory })) using (var session = client.CreateSession(auth)) { //Send Request var searchContent = await session.CallAsync(builer.Build()); Assert.That(searchContent, Is.Not.Null, "search content is null!"); Assert.That(searchContent.Options, Is.Not.Null, "Options is null!"); Assert.That(searchContent.Options.First().Alias, Is.Not.Null, "Alias is null!"); Assert.That(searchContent.Options.First().ParentId, Is.Not.Null.Or.Not.EqualTo(0), "Parent is null or 0!"); //Assert.That(searchContent.Options.First().Name, Is.Not.Null, "Name is null!"); } }