Example #1
0
        public async Task CreateWithBillingPermissionsAsync()
        {
            // Arrange
            var name = "API Key with billing permissions";

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Post, Utils.GetSendGridApiUri(ENDPOINT)).Respond("application/json", SINGLE_API_KEY_JSON);

            var client  = Utils.GetFluentClient(mockHttp);
            var apiKeys = new ApiKeys(client);

            // Act
            var result = await apiKeys.CreateWithBillingPermissionsAsync(name, null, CancellationToken.None).ConfigureAwait(false);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
            result.ShouldNotBeNull();
        }