public void Offer_Search()
 {
     Elements.Delay(5000);
     OfferSearch.SelectClient();
     //OfferSearch.ShowFlagForFollowUp();
     //Elements.Delay(3000);
     //OfferSearch.ShowWatchList();
     //Elements.Delay(3000);
     //OfferSearch.Search( "offerCode","brand","mediaType","Hola","marketArea","prodCateg");
     //Elements.Delay(3000);
     //OfferSearch.Download();
     //OfferSearch.GoToOfferSearchTab();
     Elements.Delay(3000);
     OfferSearch.SearchByOfferCode("010001");
     //Elements.Delay(3000);
     //OfferSearch.SearchByBrand("");
     Elements.Delay(3000);
     OfferSearch.SearchByMediaType("IRC");
     //Elements.Delay(3000);
     //OfferSearch.SearchByDivision("");
     //Elements.Delay(3000);
     //OfferSearch.SearchByMarketArea("");
     //Elements.Delay(3000);
     //OfferSearch.SearchByProductCategory("");
 }
Exemplo n.º 2
0
 public OfferDto Execute(OfferSearch search)
 {
     return(_context.Offers
            .Include(x => x.Ad)
            .Include(x => x.User)
            .Where(w => w.AdId == search.AdId && w.UserId == search.UserId)
            .Select(s => new OfferDto()
     {
         AdSubject = s.Ad.Subject,
         Amount = s.Amount,
         Id = s.AdId
     }).SingleOrDefault());
 }
        public IEnumerable <OfferListDto> Execute(OfferSearch request)
        {
            var offers = _context
                         .Offers
                         .Include(x => x.Ad)
                         .ThenInclude(x => x.User)
                         .Where(w => w.UserId == request.UserId)
                         .Select(s => new OfferListDto()
            {
                AdSubject = s.Ad.Subject,
                Id        = s.Id,
                Amount    = s.Amount,
                Email     = s.User.Email
            }).ToList();

            return(offers);
        }
Exemplo n.º 4
0
        public void Test_Find()
        {
            #region Arrange
            var tmpCustomer = new CustomerConnector().Create(new Customer()
            {
                Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis"
            });
            var tmpArticle = new ArticleConnector().Create(new Article()
            {
                Description = "TmpArticle", Type = ArticleType.Stock, PurchasePrice = 100
            });
            #endregion Arrange

            IOfferConnector connector = new OfferConnector();
            var             newOffer  = new Offer()
            {
                Comments       = "TestOrder",
                CustomerNumber = tmpCustomer.CustomerNumber,
                OfferDate      = new DateTime(2019, 1, 20), //"2019-01-20",
                OfferRows      = new List <OfferRow>()
                {
                    new OfferRow()
                    {
                        ArticleNumber = tmpArticle.ArticleNumber, Quantity = 10
                    },
                    new OfferRow()
                    {
                        ArticleNumber = tmpArticle.ArticleNumber, Quantity = 20
                    },
                    new OfferRow()
                    {
                        ArticleNumber = tmpArticle.ArticleNumber, Quantity = 15
                    }
                }
            };

            //Add entries
            for (var i = 0; i < 5; i++)
            {
                connector.Create(newOffer);
            }

            //Apply base test filter
            var searchSettings = new OfferSearch();
            searchSettings.CustomerNumber = tmpCustomer.CustomerNumber;
            var fullCollection = connector.Find(searchSettings);

            Assert.AreEqual(5, fullCollection.TotalResources);
            Assert.AreEqual(5, fullCollection.Entities.Count);
            Assert.AreEqual(1, fullCollection.TotalPages);

            Assert.AreEqual(tmpCustomer.CustomerNumber, fullCollection.Entities.First().CustomerNumber);

            //Apply Limit
            searchSettings.Limit = 2;
            var limitedCollection = connector.Find(searchSettings);

            Assert.AreEqual(5, limitedCollection.TotalResources);
            Assert.AreEqual(2, limitedCollection.Entities.Count);
            Assert.AreEqual(3, limitedCollection.TotalPages);

            //Delete entries (DELETE not supported)
            foreach (var offer in fullCollection.Entities)
            {
                connector.Cancel(offer.DocumentNumber);
            }

            #region Delete arranged resources
            new CustomerConnector().Delete(tmpCustomer.CustomerNumber);
            //new ArticleConnector().Delete(tmpArticle.ArticleNumber);
            #endregion Delete arranged resources
        }