Exemplo n.º 1
0
        public void FiftyLinqTest()
        {
            //А здесь я придумал самый простой способ, как сформировать 50 записей
            RestSearchHelper.ConfigureDefaultSearch(upperSearch, 25);

            var response = RestSearchHelper.Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual(System.Net.HttpStatusCode.OK, response.StatusCode);


            RestSearchHelper.ConfigureSearch(upperSearch, 25, 25);
            var secResponse = RestSearchHelper.Execute();

            Assert.IsNotNull(secResponse);
            Assert.AreEqual(System.Net.HttpStatusCode.OK, secResponse.StatusCode);

            var results = ResponseHelper.Deserialize(ResponseHelper.ConcatResponses(response.Content, secResponse.Content));

            Assert.IsTrue(results.Count > 0);

            results.ForEach(res => Assert.IsTrue(
                                res.Title.ToLower().Contains(lowerSearch) ||
                                res.Description.ToLower().Contains(lowerSearch)
                                )
                            );
        }
Exemplo n.º 2
0
        public void JumpingLinqTest()
        {
            RestSearchHelper.ConfigureDefaultSearch(anySearch, 25);

            var response = RestSearchHelper.Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);

            var results = ResponseHelper.Deserialize(response.Content);

            Assert.IsTrue(results.Count > 0);

            results.ForEach(res => Assert.IsTrue(
                                res.Title.ToLower().Contains(lowerSearch) ||
                                res.Description.ToLower().Contains(lowerSearch)
                                )
                            );
        }
Exemplo n.º 3
0
        public void UpperLinqTest()
        {
            //API сайта отбивает запросы с top>25, поэтому пара стандартных проверок
            RestSearchHelper.ConfigureDefaultSearch(upperSearch, 25);

            var response = RestSearchHelper.Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);

            var results = ResponseHelper.Deserialize(response.Content);

            Assert.IsTrue(results.Count > 0);

            results.ForEach(res => Assert.IsTrue(
                                res.Title.ToLower().Contains(lowerSearch) ||
                                res.Description.ToLower().Contains(lowerSearch)
                                )
                            );
        }