Example #1
0
        public async Task Should_get_a_Directory_object_from_the_default_endpoint()
        {
            // Arrange
            var http      = new FakeHttpMessageHandler("http://baseaddress/");
            var directory = new Directory();

            var client =
                http.RequestTo("directory").Returns(directory).WithNonce("nonce")
                .GetHttpClient();

            var sut = new AcmeClient(client, new RSACryptoServiceProvider());

            // Act
            var discoverResponse = await sut.DiscoverAsync();

            // Assert
            discoverResponse.Should().NotBeNull();
        }
Example #2
0
        public async Task Should_get_a_Directory_object_from_the_default_endpoint()
        {
            // Arrange
            var http = new FakeHttpMessageHandler("http://baseaddress/");
            var directory = new Directory();

            var client = 
                http.RequestTo("directory").Returns(directory).WithNonce("nonce")
                .GetHttpClient();

            var sut = new AcmeClient(client, new RSACryptoServiceProvider());

            // Act
            var discoverResponse = await sut.DiscoverAsync();

            // Assert
            discoverResponse.Should().NotBeNull();
        }
Example #3
0
        public async Task Can_discover_urls()
        {
            var key = RSA.Create(2048);

            var httpClient = new HttpClient {
                BaseAddress = new Uri("https://acme-staging.api.letsencrypt.org")
            };

            var client = new AcmeClient(httpClient, key);


            var directory = await client.DiscoverAsync();

            Assert.Equal(new Uri("https://acme-staging.api.letsencrypt.org/acme/new-reg"), directory.NewRegistration);
            Assert.Equal(new Uri("https://acme-staging.api.letsencrypt.org/acme/new-authz"), directory.NewAuthorization);
            Assert.Equal(new Uri("https://acme-staging.api.letsencrypt.org/acme/new-cert"), directory.NewCertificate);
            Assert.Equal(new Uri("https://acme-staging.api.letsencrypt.org/acme/revoke-cert"), directory.RevokeCertificate);
            Assert.Equal(new Uri("https://acme-staging.api.letsencrypt.org/acme/key-change"), directory.KeyChange);

            Assert.Equal("https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf", directory.Meta.TermsOfService);
        }