feat: Add endpoints

This commit is contained in:
Valters Melnalksnis
2022-06-14 20:13:08 +03:00
parent 9eb16c07e8
commit 5a458e0c53
45 changed files with 1295 additions and 24 deletions
@@ -0,0 +1,38 @@
// Copyright 2022 Valters Melnalksnis
// Licensed under the Apache License 2.0.
// See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NodaTime;
namespace VMelnalksnis.NordigenDotNet.DependencyInjection.Tests;
public sealed class ServiceCollectionExtensionsTests
{
[Fact]
public void AddNordigenDotNet_ShouldRegisterRequiredServices()
{
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(new List<KeyValuePair<string, string>>
{
new($"{NordigenOptions.SectionName}:{nameof(NordigenOptions.BaseAddress)}", "https://ob.nordigen.com/"),
new($"{NordigenOptions.SectionName}:{nameof(NordigenOptions.SecretId)}", $"{Guid.NewGuid():D}"),
new($"{NordigenOptions.SectionName}:{nameof(NordigenOptions.SecretKey)}", $"{Guid.NewGuid():N}"),
})
.Build();
var serviceCollection = new ServiceCollection();
serviceCollection.AddNordigenDotNet(configuration, DateTimeZoneProviders.Tzdb);
var serviceProvider = serviceCollection.BuildServiceProvider();
var nordigenClient = serviceProvider.GetRequiredService<INordigenClient>();
nordigenClient.Should().NotBeNull();
}
}