Exemple #1
0
        public void Perform_updates_link_and_OfferType_in_inactive_Offer()
        {
            var offer = new Offer()
            {
                Id             = "offer_id_1",
                Link           = "http://www.placeholder.com",
                Title          = "title",
                Cost           = 100.0,
                BonusCost      = 1.0,
                District       = "wealthy",
                Rooms          = 42,
                Area           = 1,
                DateOfPosting  = "1970-01-01",
                DateOfScraping = "1970-01-01",
                Latitude       = 1,
                Longitude      = 1,
                OfferType      = OfferType.Olx,
            };

            _dbOfferRepository.Insert(offer);
            _sut.Perform();

            var result = _dbOfferRepository.Get(OfferConstants.OfferId, "offer_id_1", OfferConstants.CollectionName, 1).First();

            Assert.AreEqual(string.Empty, result.Link);
        }
Exemple #2
0
        public void Get_returns_specified_number_of_documents_queried_by_expression()
        {
            var offer1 = new MarklogicDataLayer.DataStructs.Offer
            {
                Id             = "1",
                Title          = "title",
                Cost           = 100.0,
                BonusCost      = 1.0,
                District       = "wealthy",
                Rooms          = 42,
                Area           = 1,
                DateOfPosting  = "1970-01-01",
                DateOfScraping = "1970-01-01",
                Latitude       = 1,
                Longitude      = 1,
                Link           = "asd",
                TotalCost      = 101.0,
            };
            var offer2 = new MarklogicDataLayer.DataStructs.Offer
            {
                Id             = "2",
                Title          = "title2",
                Cost           = 101.0,
                BonusCost      = 11.0,
                District       = "wealthy2",
                Rooms          = 422,
                Area           = 1,
                DateOfPosting  = "1971-01-01",
                DateOfScraping = "1972-01-01",
                Latitude       = 1,
                Longitude      = 1,
                Link           = "qwe",
            };
            var offer3 = new MarklogicDataLayer.DataStructs.Offer
            {
                Id             = "3",
                Title          = "title3",
                Cost           = 101.0,
                BonusCost      = 11.0,
                District       = "wealthy2",
                Rooms          = 422,
                Area           = 1,
                DateOfPosting  = "1971-01-01",
                DateOfScraping = "1972-01-01",
                Latitude       = 1,
                Longitude      = 1,
                Link           = "123",
            };

            _sut.Insert(new[] { offer1, offer2, offer3 });
            var result = _sut.Get("district", "wealthy2", OfferConstants.CollectionName, 1).ToList();

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("wealthy2", result.First().District);
        }