예제 #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 FindServerAsync_CanFindServer(string expected, string label, string identifer)
        {
            var server = await api.FindServerAsync(label, identifer);

            Assert.Equal(expected, server.Label);
        }