diff --git a/Directory.Packages.props b/Directory.Packages.props index dfd699f8..2f925768 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,14 +8,14 @@ - - - + + + - - + + diff --git a/src/Chapter05.Tests/Listing05.15.PassingCommandLineArgumentsToMain.Tests.cs b/src/Chapter05.Tests/Listing05.15.PassingCommandLineArgumentsToMain.Tests.cs index 1e066e4f..b1224c9c 100644 --- a/src/Chapter05.Tests/Listing05.15.PassingCommandLineArgumentsToMain.Tests.cs +++ b/src/Chapter05.Tests/Listing05.15.PassingCommandLineArgumentsToMain.Tests.cs @@ -33,7 +33,23 @@ public void Main_IntelliTectIndexHtmlArgs_DownloadFile() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, () => result = Program.Main(args)); } - catch (AggregateException exception) when (exception.InnerException is System.Net.Http.HttpRequestException) + catch (AggregateException exception) when ( + exception.InnerException is System.Net.Http.HttpRequestException || + exception.InnerException is System.Net.Sockets.SocketException || + exception.InnerException is TaskCanceledException || + exception.InnerException is System.Net.NetworkInformation.NetworkInformationException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (System.Net.Http.HttpRequestException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (System.Net.Sockets.SocketException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (TaskCanceledException) { Assert.Inconclusive("Unable to download the file. Check your internet connection."); } @@ -48,7 +64,23 @@ public void Main_GoodArgs_DownloadFile() { Assert.AreEqual(0, Program.Main(args)); } - catch (AggregateException exception) when (exception.InnerException is System.Net.Http.HttpRequestException) + catch (AggregateException exception) when ( + exception.InnerException is System.Net.Http.HttpRequestException || + exception.InnerException is System.Net.Sockets.SocketException || + exception.InnerException is TaskCanceledException || + exception.InnerException is System.Net.NetworkInformation.NetworkInformationException) + { + Assert.Inconclusive("Unable to download the file. Check your Internet connection."); + } + catch (System.Net.Http.HttpRequestException) + { + Assert.Inconclusive("Unable to download the file. Check your Internet connection."); + } + catch (System.Net.Sockets.SocketException) + { + Assert.Inconclusive("Unable to download the file. Check your Internet connection."); + } + catch (TaskCanceledException) { Assert.Inconclusive("Unable to download the file. Check your Internet connection."); } diff --git a/src/Chapter05.Tests/Listing05.33.CustomParameterValidation.Tests.cs b/src/Chapter05.Tests/Listing05.33.CustomParameterValidation.Tests.cs index 20293144..881d33c1 100644 --- a/src/Chapter05.Tests/Listing05.33.CustomParameterValidation.Tests.cs +++ b/src/Chapter05.Tests/Listing05.33.CustomParameterValidation.Tests.cs @@ -175,7 +175,23 @@ public void Main_IntelliTectIndexHtmlArgs_DownloadFile() IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, () => result = Program.Main(args)); } - catch (AggregateException exception) when (exception.InnerException is System.Net.Http.HttpRequestException) + catch (AggregateException exception) when ( + exception.InnerException is System.Net.Http.HttpRequestException || + exception.InnerException is System.Net.Sockets.SocketException || + exception.InnerException is TaskCanceledException || + exception.InnerException is System.Net.NetworkInformation.NetworkInformationException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (System.Net.Http.HttpRequestException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (System.Net.Sockets.SocketException) + { + Assert.Inconclusive("Unable to download the file. Check your internet connection."); + } + catch (TaskCanceledException) { Assert.Inconclusive("Unable to download the file. Check your internet connection."); }