Esempio n. 1
0
        public static async Task Main(string[] args)
        {
            var httpClient  = new HttpClient();
            var httpClient2 = new HttpClient();

            var clientDiceRoll = new DiceRoll(httpClient, TimeSpan.FromSeconds(1));

            var dice = await clientDiceRoll.GetDiceRolled();

            if (dice != null)
            {
                var diceCount = FormattingHelper.FormatDiceCount(dice);

                foreach (var line in diceCount)
                {
                    Console.WriteLine(line);
                }

                string ordered = FormattingHelper.FormatDiceOrdered(dice);

                Console.Error.WriteLine(ordered);

                var json = FormattingHelper.FormatToJsonOrdered(dice);

                var clientRequestBin = new RequestBin(httpClient2, TimeSpan.FromSeconds(1));

                if (!await clientRequestBin.Post(json))
                {
                    Console.Error.WriteLine("Post to request bin service failed");
                }
            }
        }
        public void FormatDiceOrdered()
        {
            var result = FormattingHelper.FormatDiceOrdered(_dice);

            // you have a bug in your spec, expected result is not "1 1 2 2 3 4 4 5 5 6 6" (number 4 is only once in the input)
            Assert.Equal("1 1 2 2 3 4 5 5 6 6", result);
        }