netmash/NDB.Testing.App/Program.cs

34 lines
861 B
C#
Raw Normal View History

2019-10-29 00:11:42 +02:00
using Microsoft.Extensions.DependencyInjection;
using NDB.Infrastructure.PublicIP;
using NDB.Infrastructure.PublicIP.Services;
using System;
using System.Threading.Tasks;
namespace NDB.Testing.App
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
var provider = GetServiceProvider();
var service = provider.GetService<IPublicIPService>();
var result = await service.GetPublicIP();
Console.WriteLine(result.ip);
Console.ReadKey();
}
private static IServiceProvider GetServiceProvider()
{
var services = new ServiceCollection();
services.AddPublicIPService();
var provider = services.BuildServiceProvider();
return provider;
}
}
}