public void Create_WithoutCertificate_ShouldAddNothingToRequest() { var client = new TestableClientCertificateWebClient(null); var payload = "Doesn't matter"; var destination = new Uri("https://localhost/Endpoint"); try { client.UploadString(destination, payload); } catch (Exception) { //Destination is not listening, but we should get an exception that shows it // at least tried to connect there. } client.HasCertificatesInRequest.Should().BeFalse(); }
public void Create_WithCertificate_ShouldAddCertificateToRequest() { var config = KentorAuthServicesSection.Current; var options = new SPOptions(config); var client = new TestableClientCertificateWebClient(options.ArtifactResolutionTlsCertificate); var payload = "Doesn't matter"; var destination = new Uri("https://localhost/Endpoint"); try { client.UploadString(destination, payload); } catch (Exception) { //Destination is not listening, but we should get an exception that shows it // at least tried to connect there. } client.HasCertificateInRequest.ShouldBeEquivalentTo(true); }
public void Create_WithCertificate_ShouldAddCertificateToRequest() { var config = SustainsysSaml2Section.Current; var options = new SPOptions(config); var client = new TestableClientCertificateWebClient( options.ServiceCertificates .Where(sc => sc.Use.HasFlag(CertificateUse.TlsClient)) .Select(sc => sc.Certificate)); var payload = "Doesn't matter"; var destination = new Uri("https://localhost/Endpoint"); try { client.UploadString(destination, payload); } catch (Exception) { //Destination is not listening, but we should get an exception that shows it // at least tried to connect there. } client.HasCertificatesInRequest.Should().BeTrue(); }