feat: adds endpoints 'client contacts' and 'contacts' and integration tests for all existing endpoints.

This commit is contained in:
Matthias Langhard
2021-03-24 08:22:58 +01:00
parent dd92939a6f
commit c5734a065c
28 changed files with 775 additions and 145 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Net.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Novaloop.PaymoApi.Extensions;
using Novaloop.PaymoApi.Shared;
namespace Novaloop.PaymoApi.Tests
{
public static class DependencyFactory
{
public static PaymoApiClient GeneratePaymoApiClient()
{
return new PaymoApiClient(new HttpClient {BaseAddress = new Uri("https://app.paymoapp.com/")});
}
public static IOptions<PaymoApiOptions> GenerateOptions()
{
var paymoToken = new ConfigurationBuilder()
.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("appsettings.tests.json", true, true)
.AddEnvironmentVariables()
.Build()
.GetSection("PaymoApiIntegrationTests:PaymoTestProjectToken").Value;
if (string.IsNullOrWhiteSpace(paymoToken))
{
throw new ArgumentException("Please set the environment variable 'PAYMOAPIINTEGRATIONTESTS__PAYMOTESTPROJECTTOKEN' with the token of your paymo test-project. Look inside Bitwarden if you work @ Novaloop.");
}
return Options.Create(new PaymoApiOptions {ApiToken = paymoToken});
}
}
}