Exemplo n.º 1
0
        public async void Invoke_Null_IDeviceResolver_ThrowsArgumentNullException()
        {
            var options    = Options.Create(new ResponsiveOptions());
            var middleware = new ResponsiveMiddleware(d => Task.Factory.StartNew(() => d), options);

            await Assert.ThrowsAsync <ArgumentNullException>(async() => await middleware.Invoke(null, new DeviceResolver()));
        }
Exemplo n.º 2
0
        public async void Invoke_HttpContext_Null_ThrowsNullReferenceException()
        {
            var context    = new DefaultHttpContext();
            var options    = Options.Create(new ResponsiveOptions());
            var middleware = new ResponsiveMiddleware(d => Task.Factory.StartNew(() => d), options);

            await Assert.ThrowsAsync <NullReferenceException>(async() => await middleware.Invoke(context, null));
        }
Exemplo n.º 3
0
        public async void Invoke_HttpContext_IDeviceResolver_Success()
        {
            var context    = new DefaultHttpContext();
            var options    = Options.Create(new ResponsiveOptions());
            var middleware = new ResponsiveMiddleware(d => Task.Factory.StartNew(() => d), options);

            await middleware.Invoke(context, new DeviceResolver());

            Assert.Same(DeviceType.Tablet.ToString(), context.GetDevice().Device);
        }