Esempio n. 1
0
        public async Task Size_For_UnderFour_Expect_OK(int age)
        {
            //ARRAGE
            int   length = 180;
            Style style  = Style.Classic;

            skiRepo.Setup(x => x.GetItemAsync(length, style)).ReturnsAsync(new Ski {
                Length = 180, Style = style
            });

            //ACT
            var ski = await skiService.GetSki(length, age, Style.Classic);

            //ASSERT
            Assert.AreEqual(length, ski.Length);
            Assert.AreEqual(Style.Classic, ski.Style);
        }
Esempio n. 2
0
        //public async Task<Ski> GetTaskAsync()
        //{
        //    using (var client = new HttpClient())
        //    {
        //        client.BaseAddress = new Uri("http://localhost:44322/");
        //        client.DefaultRequestHeaders.Accept.Clear();
        //        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        //        HttpResponseMessage response = await client.GetAsync("api/Ski");
        //        if (response.IsSuccessStatusCode)
        //        {
        //          return repsonse;
        //        }
        //    }
        //}
        public Ski GetAsync(string length, string age, string selectStyle)
        {
            SkiService skiService = new SkiService(skiRepository, skiSizeLogic);
            var        style      = (Style)Enum.Parse(typeof(Style), selectStyle);
            var        answer     = skiService.GetSki(int.Parse(length), int.Parse(age), style).Result;

            return(answer);
        }