Ejemplo n.º 1
0
        //Should fail as no headers in API request
        public void TestNoHeaders()
        {
            var ctl      = new SympliTaskBackend.Controllers.SEOSearchController();
            var response = ctl.Get();

            Assert.IsTrue(!response.Success);
        }
Ejemplo n.º 2
0
        public void TestYahooSearchSuccess()
        {
            var mockContext = new Microsoft.AspNetCore.Http.DefaultHttpContext();

            mockContext.Request.Headers.Add("searchString", "e-Settlements");
            mockContext.Request.Headers.Add("targetUrl", "www.sympli.com.au");
            mockContext.Request.Headers.Add("resultsCount", "100");
            mockContext.Request.Headers.Add("engineTypeId", $"{(int)SearchEngineType.Yahoo}");

            var ctl = new SympliTaskBackend.Controllers.SEOSearchController()
            {
                ControllerContext = new Microsoft.AspNetCore.Mvc.ControllerContext()
                {
                    HttpContext = mockContext
                }
            };

            var response = ctl.Get();

            Assert.IsTrue(response.Success);
        }