public void ShouldSearchManualRequestHasCorrectQueryString()
        {
            var requestService = new Mock <IRequestService>();

            var passedUrl = string.Empty;

            requestService.Setup(x => x.GetRequest <PageResult <MeshNameAttributeClassTest> >(It.IsAny <string>())).Callback((string url) =>
            {
                passedUrl = url;
            }).Returns(() =>
            {
                return(Task.FromResult(It.IsAny <PageResult <MeshNameAttributeClassTest> >()));
            }).Verifiable();

            var service    = new MeshesService(requestService.Object);
            var pageNumber = new Random().Next();
            var pageSize   = new Random().Next();

            var searchFilter = "{ 'FavoriteNumber': { '$gt': 5000 } }";
            var orderBy      = "{ FavoriteNumber: -1 }";

            service.Search <MeshNameAttributeClassTest>(searchFilter, orderBy, pageNumber, pageSize);
            var encodedFilter  = WebUtility.UrlEncode(searchFilter);
            var encodedOrderBy = WebUtility.UrlEncode("{ FavoriteNumber: -1 }");

            Assert.Equal($"meshes/{MeshName.ToLowerInvariant()}?filter={encodedFilter}&orderby={encodedOrderBy}&page={pageNumber}&pageSize={pageSize}", passedUrl);

            requestService.VerifyAll();
        }
        public void ShouldSearchManualRequestHaveCorrectMeshNameFromAttributeAndUrl()
        {
            var requestService = new Mock <IRequestService>();

            var passedUrl = string.Empty;

            requestService.Setup(x => x.GetRequest <PageResult <MeshNameAttributeClassTest> >(It.IsAny <string>())).Callback((string url) =>
            {
                passedUrl = url;
            }).Returns(() =>
            {
                return(Task.FromResult(It.IsAny <PageResult <MeshNameAttributeClassTest> >()));
            }).Verifiable();

            var service = new MeshesService(requestService.Object);

            service.Search <MeshNameAttributeClassTest>();

            Assert.Equal($"meshes/{MeshName.ToLowerInvariant()}?filter=&orderby=&page=1&pageSize=25", passedUrl);

            requestService.VerifyAll();
        }
        public void ShouldSearchCompiledRequestHaveCorrectMeshNameFromClassAndUrl()
        {
            var requestService = new Mock <IRequestService>();

            var passedUrl = string.Empty;

            requestService.Setup(x => x.GetRequest <PageResult <TestMeshNameFromClass> >(It.IsAny <string>())).Callback((string url) =>
            {
                passedUrl = url;
            }).Returns(() =>
            {
                return(Task.FromResult(It.IsAny <PageResult <TestMeshNameFromClass> >()));
            }).Verifiable();

            var service = new MeshesService(requestService.Object);

            service.Search <TestMeshNameFromClass>(x => true);

            var encodedFilter = WebUtility.UrlEncode("{ }");

            Assert.Equal($"meshes/testmeshnamefromclass?filter={encodedFilter}&orderby=&page=1&pageSize=25", passedUrl);

            requestService.VerifyAll();
        }