public static void ThrowsOnMissingRegistration_Throws_If_Options_Is_Null()
    {
        // Arrange
        HttpClientInterceptorOptions options = null;

        // Act and Assert
        Should.Throw <ArgumentNullException>(() => options.ThrowsOnMissingRegistration(), "options");
    }
    public static void ThrowsOnMissingRegistration_Sets__To_True()
    {
        // Arrange
        var options = new HttpClientInterceptorOptions();

        // Act
        options.ThrowsOnMissingRegistration().ShouldBe(options);

        // Assert
        options.ThrowOnMissingRegistration.ShouldBeTrue();
    }
        public void AcquireSdk()
        {
            using var sw = new StringWriter();
            Console.SetOut(sw);

            var textWriter         = new ConsoleTextWriter();
            var installerLauncher  = new TestInstallerLauncher();
            var platformIdentifier = new TestPlatformIdentifier();
            var dotnetInfo         = new TestDotnetInfo();

            var options = new HttpClientInterceptorOptions();

            _ = new HttpRequestInterceptionBuilder()
                .Requests()
                .ForHttps()
                .ForGet()
                .ForHost("raw.githubusercontent.com")
                .ForPath("/dotnet/core/master/release-notes/releases-index.json")
                .Responds()
                .WithContentStream(() => File.OpenRead("./TestReleaseData/releases-index.json"))
                .RegisterWith(options);

            _ = new HttpRequestInterceptionBuilder()
                .Requests()
                .ForHttps()
                .ForHost("dotnetcli.blob.core.windows.net")
                .ForGet()
                .ForPath("/dotnet/release-metadata/2.2/releases.json")
                .Responds()
                .WithContentStream(() => File.OpenRead("./TestReleaseData/2.2-releases.json"))
                .RegisterWith(options);

            _ = new HttpRequestInterceptionBuilder()
                .Requests()
                .ForHttps()
                .ForHost("download.visualstudio.microsoft.com")
                .ForGet()
                .ForPath("/download/pr/29457b8f-6262-4c4b-8a54-eef308346842/3c7ec575796a2ef0e826a07ca4d13084/dotnet-sdk-2.2.100-osx-x64.pkg")
                .Responds()
                .WithContentStream(() => new MemoryStream(Encoding.UTF8.GetBytes("install me")))
                .RegisterWith(options);

            using var httpClient = options.ThrowsOnMissingRegistration().CreateHttpClient();

            var a = new GlobalJsonVersion(textWriter);

            new SdkAcquirer(httpClient, textWriter, installerLauncher, platformIdentifier, dotnetInfo)
            .Acquire(a).Wait();

            var installerPath = installerLauncher.LastLaunchedInstaller;

            installerPath.ShouldNotBeNullOrEmpty();
            File.ReadAllLines(installerPath).ShouldHaveSingleItem().ShouldBe("install me");
        }