예제 #1
0
        public async Task null_params_throw()
        {
            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => SystemNetHttpExtensions.DownloadFileAsync((HttpClient)null, "url", "file"));

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => SystemNetHttpExtensions.DownloadFileAsync(new Mock <HttpClient>().Object, null, "file"));

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => SystemNetHttpExtensions.DownloadFileAsync(new Mock <HttpClient>().Object, "url", null));
        }
예제 #2
0
        public async Task blank_params_throw()
        {
            var mock = new Mock <HttpClient>().Object;
            await Assert.ThrowsExceptionAsync <ArgumentException>(() => SystemNetHttpExtensions.DownloadFileAsync(mock, "", "file"));

            await Assert.ThrowsExceptionAsync <ArgumentException>(() => SystemNetHttpExtensions.DownloadFileAsync(mock, "   ", "file"));

            await Assert.ThrowsExceptionAsync <ArgumentException>(() => SystemNetHttpExtensions.DownloadFileAsync(mock, "url", ""));

            await Assert.ThrowsExceptionAsync <ArgumentException>(() => SystemNetHttpExtensions.DownloadFileAsync(mock, "url", "   "));
        }