feat: adds endpoints 'client contacts' and 'contacts' and integration tests for all existing endpoints.
This commit is contained in:
34
tests/DependencyFactory.cs
Normal file
34
tests/DependencyFactory.cs
Normal 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});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user