public void ParsesEmpty() { var context = new FilteringContext(Enumerable.Empty <KeyValuePair <string, string> >()); var actual = context.Properties; Assert.Equal(Enumerable.Empty <FilteringProperty>(), actual); }
public void WhenIFilter(int minPrice, int maxPrice) { var pageSource = driver.PageSource; var booksResultsPage = new FilterPage(driver); FilteringContext.FilterByPriceRange(booksResultsPage, minPrice, maxPrice); wait.Until(d => d.PageSource != pageSource); ScenarioContext.Current.Set(new KeyValuePair <int, int>(minPrice, maxPrice), "filterLimits"); }
/// <summary> /// See base class documentation. /// </summary> /// <param name="actionContext">The action context.</param> public override void OnActionExecuting(HttpActionContext actionContext) { var queryParams = actionContext.Request.GetQueryNameValuePairs().ToList(); var sorting = new SortingContext(queryParams); var filtering = new FilteringContext(queryParams); var queryContext = GetQueryContext(actionContext); queryContext.Sorting = sorting; queryContext.Filtering = filtering; base.OnActionExecuting(actionContext); }
public void NegativeMinPriceShouldUpdatePriceToMinimalAvailable() { //Arrange var booksResultsPage = new FilterPage(driver); var minPriceValueToSet = 20; var maxPriceValueToSet = 250; //Act FilteringContext.FilterByPriceRange(booksResultsPage, minPriceValueToSet, maxPriceValueToSet); //Assert (FilteringContext.VerifyMinPriceValue(booksResultsPage, minPriceValueToSet) && FilteringContext.VerifyMaxPriceValue(booksResultsPage, maxPriceValueToSet)).Should().BeTrue(); }
public void FilterByPrice() { //Arrange var booksResultsPage = new FilterPage(driver); var bookPage = new GoodsItemPage(driver); var minpriceValueToSet = 20; var maxpriceValueToSet = 250; //Act FilteringContext.FilterByPriceRange(booksResultsPage, minpriceValueToSet, maxpriceValueToSet); ResultSetContext.SelectElement(booksResultsPage, 0); //Assert GoodStateVerificationContext.VerifyItemPrice(bookPage, minpriceValueToSet, maxpriceValueToSet); }
internal void ParsesCorrectly(string[] names, string[] values, string[] properties) { var context = new FilteringContext(GetQuery(names, values)); var expected = properties.Zip(values, (n, v) => new { Name = n, Value = v }).ToList(); var actual = context.Properties.Select(p => new { p.Name, p.Value }).ToList(); Assert.Equal(expected, actual); }
public static object ApplyFiltering(object data, FilteringContext context, ApiResource resource) { var queryable = data as IQueryable; if (queryable != null) { return(new FilteringInterpreter(context, resource).Apply(queryable)); } var enumerable = data as IEnumerable; if (enumerable != null) { // all queryables are enumerable, so this needs to be after // the queryable case return(new FilteringInterpreter(context, resource).Apply(enumerable)); } return(data); }
public void BuyAProduct() { //Arrange var minpriceValueToSet = 100; var maxpriceValueToSet = 2000; var name = "‘ол≥о"; var booksResultsPage = new FilterPage(driver); var SingleBookPage = new GoodsItemPage(driver); var Basket = new BasketPage(driver); var Checkout = new CheckoutPage(driver); //Act FilteringContext.FilterByPriceRange(booksResultsPage, minpriceValueToSet, maxpriceValueToSet); FilteringContext.ClickCheckbox(booksResultsPage, name); ResultSetContext.BuyElement(booksResultsPage, 0); BasketContext.ProceedToCheckout(Basket); CheckoutContext.InputReceiverData(Checkout, "Testik", "0980000001", "*****@*****.**"); //Assert GoodStateVerificationContext.VerifyMakeOrderIsClickable(Checkout); }
public void Buy() { //Arrange var minpriceValueToSet = 100; var maxpriceValueToSet = 2000; var name = "ю-аю-аю-цю-кю-лю-цю"; int HowCanlongIwait = 15000; var booksResultsPage = new FilterPage(driver); var SingleBookPage = new GoodsItemPage(driver); var Basket = new BasketPage(driver); var Checkout = new CheckoutPage(driver); //Act FilteringContext.FilterByPriceRange(booksResultsPage, minpriceValueToSet, maxpriceValueToSet, HowCanlongIwait); FilteringContext.ClickCheckbox(booksResultsPage, name, HowCanlongIwait); ResultSetContext.BuyElement(booksResultsPage, 0, HowCanlongIwait); BasketContext.ProceedToCheckout(Basket, HowCanlongIwait); CheckoutContext.InputReceiverData(Checkout, HowCanlongIwait);//modification with volid date //Assert VerificationContext.VerifyMakeOrderIsClickable(Checkout); }