public async Task Fetch_List()
        {
            var expected = new[] { 1, 2 };
            var list     = new List(null, expected);
            var api      = new Mock <ISampleApi>();

            api
            .Setup(api => api.GetListAsync())
            .Returns(Task.FromResult(list));

            var client = new SampleClient(api.Object);
            var ids    = await client.Ids().ToArrayAsync();

            CollectionAssert.AreEqual(expected, ids);
        }
예제 #2
0
        static void Main(string[] args)
        {
            var firstArg = args.FirstOrDefault();

            if (string.IsNullOrWhiteSpace(firstArg))
            {
                Console.WriteLine("Select a client:");
                Console.WriteLine("");
                Console.WriteLine("gg  = destiny.gg");
                Console.WriteLine("ggl = destiny.gg listening only");
                Console.WriteLine("t   = twitch.tv");
                Console.WriteLine("tl  = twitch.tv listening only");
                Console.WriteLine("s   = sample client");
                firstArg = Console.ReadLine();
            }

            IClientVisitor client;

            switch (firstArg)
            {
            case "gg":
                client = new WebSocketClient(PrivateConstants.BotWebsocketAuth);
                break;

            case "ggl":
                client = new WebSocketListenerClient(PrivateConstants.BotWebsocketAuth);
                break;

            case "t":
                client = new SimpleIrcClient(server, port, channel, nick, pass);
                break;

            case "tl":
                client = new SimpleIrcListenerClient(server, port, channel, nick, pass);
                break;

            case "s":
                client = new SampleClient();
                break;

            default:
                throw new Exception("Invalid input");
            }

            new PrimaryLogic(client).Run();
        }
예제 #3
0
        static void Main(string[] args)
        {
            SampleClient.TestUsage();
            var value = "";
            var fig   = new Figlet();

            fig.PrepareAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.");
            while (value.ToLower() != "quit")
            {
                System.Console.Write("Enter text to be converted (Quit for exit) :");
                value = System.Console.ReadLine();
                var asciiart = fig.ToAsciiArt(value);
                System.Console.WriteLine(asciiart);

                var recognize = fig.RecognizeAsciiArt(asciiart);
                System.Console.WriteLine("OCR-ArtASCII: {0}", recognize);
            }
        }
예제 #4
0
        private static void Main(string[] args)
        {
            var sample = new SampleClient("127.0.0.1", 3202).Connect();

            if (!sample.EncryptConnection())
            {
                return;
            }

            while (!sample.Whitelisted())
            {
                Console.Write("You are not whitelisted, please enter serial: ");
                var res = sample.Register(Console.ReadLine());
                Console.WriteLine(res == RequestState.Success ? "Key was valid" : "Key was not valid");
            }

            sample.Close();
            Console.WriteLine("Gg! you have a license!");

            Console.ReadKey();
        }
        public async Task Fetch_Details()
        {
            var tom      = new Detail(1, "Tom", 3, "(123) 456-7890", "http://example.com/cat.jpg", "...");
            var jerry    = new Detail(2, "Jerry", 1, "(123) 456-7890", "http://example.com/mouse.jpg", "...");
            var list     = new List(null, tom.Id, jerry.Id);
            var expected = new[] { tom, jerry };

            var api = new Mock <ISampleApi>();

            api
            .Setup(api => api.GetListAsync())
            .Returns(Task.FromResult(list));
            api
            .Setup(api => api.GetDetailAsync(tom.Id))
            .Returns(Task.FromResult(tom));
            api
            .Setup(api => api.GetDetailAsync(jerry.Id))
            .Returns(Task.FromResult(jerry));

            var client  = new SampleClient(api.Object);
            var details = await client.Details().ToArrayAsync();

            CollectionAssert.AreEqual(expected, expected);
        }
예제 #6
0
 public static void Main()
 {
     SampleClient client = new SampleClient();
 }
예제 #7
0
 static void Main(string[] args)
 {
     SampleClient.Run();
     Console.Read();
 }
 public void SetUp()
 {
     _customer     = new Customer();
     _sampleClient = new SampleClient(_customer);
 }
예제 #9
0
 static void Main(string[] args)
 {
     SampleClient.Run();
 }