public FilterStreamQueryBuilder FilterByLocations(Box box) { if (box == null) throw new ArgumentNullException("box"); var locations = new Locations(new[] {box}); _filterQuery.Locations = _filterQuery.Locations?.Concat(locations) ?? locations; return this; }
public Locations Concat(Locations locations) { if (locations == null) throw new ArgumentNullException("locations"); return new Locations(Boxes.Concat(locations.Boxes)); }
public void FilterByLocations_AnonymousData_CorrectQuery(Locations location) { var query = new Query(new HttpUtils()); var sut = new FilterStreamQueryBuilder(query); sut.FilterByLocations(location); query.Locations.ShouldBeEquivalentTo(location); }
public void GetRequest_AnonymousLocations_CorrectQuery(Locations locations) { var sut = new Query(new HttpUtils()) { Locations = locations }; var request = sut.GetRequest(); var content = request.Content.ReadAsStringAsync().Result; content.ToLower().Should().Be("locations=" + locations.ToString().Replace(",", "%2c")); }
public void FilterByLocations_AnonymousDataNotEmptyQuery_CorrectQuery(Locations location, [Frozen(Matching.ImplementedInterfaces)]Query query, FilterStreamQueryBuilder sut) { var oldValue = query.Locations; sut.FilterByLocations(location); query.Locations.ShouldBeEquivalentTo(oldValue.Concat(location)); }
public void GetRequest_AnonymousData_ContainAllParameters(Locations locations, List<long> follow, List<string> track) { var sut = new Query(new HttpUtils()) { Locations = locations, Follow = follow, Track = track}; var request = sut.GetRequest(); var content = request.Content.ReadAsStringAsync().Result; content.Should().Contain("locations="); content.Should().Contain("follow="); content.Should().Contain("track="); }
public void Concat_AnonymousData_BoxesConcated(Locations sut, Locations locations) { var result = sut.Concat(locations); result.Boxes.ShouldAllBeEquivalentTo(sut.Boxes.Concat(locations.Boxes)); }
public void ToString_AnonymousData_CorrectString(Locations sut) { sut.ToString().Should().Be(string.Join(",", sut.Boxes.Select(s => s.ToString()))); }
public FilterStreamQueryBuilder FilterByLocations(Locations location) { if (location == null) throw new ArgumentNullException("location"); _filterQuery.Locations = _filterQuery.Locations?.Concat(location) ?? location; return this; }