From 36afcdf0988e753ae2178fb8220b02f2c4d0b2b2 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 30 Jan 2022 01:41:08 +0100 Subject: refactor: Convert solution for file-scoped namespaces --- src/IOL.VippsEcommerce.Tests/ConfigurationTests.cs | 25 +++++++++++----------- src/IOL.VippsEcommerce.Tests/Helpers.cs | 25 +++++++++++----------- 2 files changed, 24 insertions(+), 26 deletions(-) (limited to 'src/IOL.VippsEcommerce.Tests') diff --git a/src/IOL.VippsEcommerce.Tests/ConfigurationTests.cs b/src/IOL.VippsEcommerce.Tests/ConfigurationTests.cs index 0890043..366dcbb 100644 --- a/src/IOL.VippsEcommerce.Tests/ConfigurationTests.cs +++ b/src/IOL.VippsEcommerce.Tests/ConfigurationTests.cs @@ -1,19 +1,18 @@ using Xunit; -namespace IOL.VippsEcommerce.Tests +namespace IOL.VippsEcommerce.Tests; + +public class InitialisationTests { - public class InitialisationTests - { - [Fact] - public void Succeed_On_Valid_Minimal_Configuration() { - var vippsEcommerceService = Helpers.GetVippsEcommerceService(o => { - o.ApiUrl = "https://validuri.no"; - o.ClientId = "asdf"; - o.ClientSecret = "asdf"; - o.SecondarySubscriptionKey = "asdf"; - }); + [Fact] + public void Succeed_On_Valid_Minimal_Configuration() { + var vippsEcommerceService = Helpers.GetVippsEcommerceService(o => { + o.ApiUrl = "https://validuri.no"; + o.ClientId = "asdf"; + o.ClientSecret = "asdf"; + o.SecondarySubscriptionKey = "asdf"; + }); - vippsEcommerceService.Configuration.Verify(); - } + vippsEcommerceService.Configuration.Verify(); } } diff --git a/src/IOL.VippsEcommerce.Tests/Helpers.cs b/src/IOL.VippsEcommerce.Tests/Helpers.cs index 6c70cd8..53dd49b 100644 --- a/src/IOL.VippsEcommerce.Tests/Helpers.cs +++ b/src/IOL.VippsEcommerce.Tests/Helpers.cs @@ -3,20 +3,19 @@ using IOL.VippsEcommerce.Models; using Microsoft.Extensions.DependencyInjection; using Xunit.Sdk; -namespace IOL.VippsEcommerce.Tests -{ - public static class Helpers - { - public static IVippsEcommerceService GetVippsEcommerceService(Action conf) { - var services = new ServiceCollection(); - services.AddVippsEcommerceService(conf); - var provider = services.BuildServiceProvider(); - var vippsEcommerceService = provider.GetService(); - if (vippsEcommerceService == default) { - throw new NullException(nameof(vippsEcommerceService)); - } +namespace IOL.VippsEcommerce.Tests; - return vippsEcommerceService; +public static class Helpers +{ + public static IVippsEcommerceService GetVippsEcommerceService(Action conf) { + var services = new ServiceCollection(); + services.AddVippsEcommerceService(conf); + var provider = services.BuildServiceProvider(); + var vippsEcommerceService = provider.GetService(); + if (vippsEcommerceService == default) { + throw new NullException(nameof(vippsEcommerceService)); } + + return vippsEcommerceService; } } -- cgit v1.3