예제 #1
0
        public async Task FindServers(string label, string identifider = null)
        {
            string result;

            if (identifider == null)
            {
                var servers = await _api.FindAllServersAsync(label);

                if (servers is null || servers.Count() == 0)
                {
                    throw new NullReferenceException("Can't find that server.");
                }

                result = Tabularize(servers);
                await ReplyAsync(result);

                return;
            }

            var server = await _api.FindServerAsync(label, identifider);

            if (server is null)
            {
                throw new NullReferenceException("Can't find that server.");
            }

            result = Tabularize(new List <ServerInfo>()
            {
                server
            });
            await ReplyAsync(result);
        }
예제 #2
0
        public async void FindAllServersAsync_CandFindAllServers(string expected, string label)
        {
            var servers = await api.FindAllServersAsync(label);

            servers.ForEach(x => Assert.Equal(expected, x.Label.Split('-')[0]));
        }