Exemplo n.º 1
0
        public async void Should_SearchClubs()
        {
            var input = new SearchClubsInput {
                Latitude = 47.051769, Longitude = 15.452930, DistanceKm = 3, UserName = "******"
            };
            var output = await _clubAppService.SearchClubs(input);

            output.Clubs.Count.ShouldBeGreaterThan(0);
        }
Exemplo n.º 2
0
        public async Task SearchClubsExt()
        {
            GeoPoint point1 = new GeoPoint(46.599550, 14.270328);

            var input = new SearchClubsInput {
                Latitude = point1.Latitude, Longitude = point1.Longitude, DistanceKm = 3.0, UserName = "******"
            };

            string json = JsonConvert.SerializeObject(input);

            string token = await Login();

            if (!string.IsNullOrEmpty(token))
            {
                string bearer = string.Format("Bearer {0}", token);


                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(_baseAddress);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Add("Authorization", bearer);

                    string url = "api/services/app/club/searchclubs";



                    HttpResponseMessage resp = await client.PostAsJsonAsync <SearchClubsInput>(url, input);

                    if (resp.IsSuccessStatusCode)
                    {
                        var respObject = await resp.Content.ReadAsAsync <WebApiContent>();

                        var output = JsonConvert.DeserializeObject <SearchClubsOutput>(respObject.result.ToString());
                        foreach (var club in output.Clubs)
                        {
                            Console.WriteLine("{0}", club.Name);
                        }
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Error Code {0}: Message - {1}", resp.StatusCode, resp.ReasonPhrase));
                    }
                }
            }
        }
Exemplo n.º 3
0
        public async void Should_SearchClubs_PeopleInside()
        {
            var hans = _memberRepository.FirstOrDefault(x => x.UserName == "Hans");

            var input = new SearchClubsInput
            {
                Latitude   = 47.051769,
                Longitude  = 15.452930,
                DistanceKm = 10,
                UserName   = hans.UserName,
                ActualTime = new DateTime(2016, 6, 8, 23, 0, 0)
            };
            var output = await _clubAppService.SearchClubs(input);

            var club1 = output.Clubs.FirstOrDefault(x => x.Id == 1);

            if (club1 != null)
            {
                club1.PeopleInside.ShouldBe(7);
                club1.FriendsInside.ShouldBe(1);
            }
        }