예제 #1
0
        public async Task InvokeAboutUnsetUrlShouldNotFire()
        {
            var about = new AboutRequester();
            var requests = new List<IRequest>();
            var req = new Request
            {
                Address = Url.Create("about://bookmarks"),
                Method = HttpMethod.Get
            };

            about.SetRoute("settings", (request, cancel) =>
            {
                requests.Add(request);
                return Task.FromResult(default(IResponse));
            });

            var response = await about.RequestAsync(req, CancellationToken.None);
            Assert.IsNull(response);
            Assert.AreEqual(0, requests.Count);
        }
예제 #2
0
        public async Task InvokeAboutUrlWithQueryShouldFire()
        {
            var about = new AboutRequester();
            var requests = new List<IRequest>();
            var req = new Request
            {
                Address = Url.Create("about://cache?device=memory"),
                Method = HttpMethod.Get
            };

            about.SetRoute("cache", (request, cancel) =>
            {
                requests.Add(request);
                return Task.FromResult(default(IResponse));
            });

            var response = await about.RequestAsync(req, CancellationToken.None);
            Assert.IsNull(response);
            Assert.AreEqual(1, requests.Count);
            Assert.AreEqual(req.Address.Data, requests[0].Address.Data);
        }
예제 #3
0
        public async Task InvokeAboutUnsetUrlShouldNotFire()
        {
            var about    = new AboutRequester();
            var requests = new List <Request>();
            var req      = new Request
            {
                Address = Url.Create("about://bookmarks"),
                Method  = HttpMethod.Get
            };

            about.SetRoute("settings", (request, cancel) =>
            {
                requests.Add(request);
                return(Task.FromResult(default(IResponse)));
            });

            var response = await about.RequestAsync(req, CancellationToken.None);

            Assert.IsNull(response);
            Assert.AreEqual(0, requests.Count);
        }
예제 #4
0
        public async Task InvokeAboutUrlWithQueryShouldFire()
        {
            var about    = new AboutRequester();
            var requests = new List <Request>();
            var req      = new Request
            {
                Address = Url.Create("about://cache?device=memory"),
                Method  = HttpMethod.Get
            };

            about.SetRoute("cache", (request, cancel) =>
            {
                requests.Add(request);
                return(Task.FromResult(default(IResponse)));
            });

            var response = await about.RequestAsync(req, CancellationToken.None);

            Assert.IsNull(response);
            Assert.AreEqual(1, requests.Count);
            Assert.AreEqual(req.Address.Data, requests[0].Address.Data);
        }