Exemplo n.º 1
0
        public void ShouldReturnHttpWebResponseAsync()
        {
            //Arrange
            var defaultHttpRequester = new DefaultHttpRequester();
            var webRequest           = WebRequest.Create("https://www.google.fr");

            //Act
            var response = defaultHttpRequester.GetResponseAsync(webRequest);

            //Assert
            Assert.IsNotNull(response.Result);
        }
Exemplo n.º 2
0
        public void ShouldThrowArgumentNullExceptionAsync()
        {
            //Arrange
            var defaultHttpRequester = new DefaultHttpRequester();

            //Act
            var ex = Assert.ThrowsException <AggregateException>(() =>
            {
                defaultHttpRequester.GetResponseAsync(null).Wait();
            });

            //Assert
            ex.Handle((Exception arg) =>
            {
                var argException = arg as ArgumentNullException;
                Assert.IsNotNull(argException);
                Assert.AreSame("request", argException.ParamName);
                return(true);
            });
        }