-
Notifications
You must be signed in to change notification settings - Fork 26
/
BitmexNetUnityExtension.cs
33 lines (30 loc) · 1.17 KB
/
BitmexNetUnityExtension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Bitmex.NET.Authorization;
using Bitmex.NET.Models;
using System;
using System.Configuration;
using Unity;
using Unity.Extension;
using Unity.Lifetime;
namespace Bitmex.NET.IntegrationTests
{
public sealed class BitmexNetUnityExtension : UnityContainerExtension
{
protected override void Initialize()
{
Container.RegisterType<IBitmexApiProxy, BitmexApiProxy>();
Container.RegisterType<IBitmexApiService, BitmexApiService>();
Container.RegisterType<IBitmexApiSocketService, BitmexApiSocketService>();
Container.RegisterType<IBitmexApiSocketProxy, BitmexApiSocketProxy>();
Container.RegisterType<IExpiresTimeProvider, ExpiresTimeProvider>(new ContainerControlledLifetimeManager());
Container.RegisterType<ISignatureProvider, SignatureProvider>(new ContainerControlledLifetimeManager());
var authorization = new BitmexAuthorization
{
Key = ConfigurationManager.AppSettings["Key"],
Secret = ConfigurationManager.AppSettings["Secret"],
BitmexEnvironment =
(BitmexEnvironment)Enum.Parse(typeof(BitmexEnvironment), ConfigurationManager.AppSettings["Environment"]),
};
Container.RegisterInstance<IBitmexAuthorization>(authorization);
}
}
}