public virtual void SetUp() { Environment.CurrentDirectory = TestContext.CurrentContext.TestDirectory; var unityContainer = new UnityContainer(); unityContainer.RegisterType <IPackageBuilder <PokerKingPackage>, PokerKingPackageBuilder>(); unityContainer.RegisterType <IPackageBuilder <PokerMasterPackage>, PokerMasterPackageBuilder>(); unityContainer.RegisterType <IPackageBuilder <Adda52Package>, Adda52PackageBuilder>(); unityContainer.RegisterType <IPacketManager <PokerKingPackage>, PokerKingPacketManager>(); unityContainer.RegisterType <IPKHandBuilder, PKHandBuilder>(); unityContainer.RegisterType <INetworkConnectionsService, NetworkConnectionsService>(); var eventAggregator = Substitute.For <IEventAggregator>(); unityContainer.RegisterInstance(eventAggregator); var tableWindowProvider = Substitute.For <IEmulatorService>(); tableWindowProvider.GetTableWindowHandle(Arg.Any <Process>()).Returns(new IntPtr(1500)); unityContainer.RegisterInstance(tableWindowProvider); var pkCatcherService = Substitute.For <IPKCatcherService>(); pkCatcherService.CheckHand(Arg.Any <HandHistory>()).Returns(true); unityContainer.RegisterInstance(pkCatcherService); var locator = new UnityServiceLocator(unityContainer); ServiceLocator.SetLocatorProvider(() => locator); testLogger = new TestLogger(); LogProvider.SetCustomLogger(testLogger); }
public override void SetUp() { base.SetUp(); testLogger = new TestLogger(); LogProvider.SetCustomLogger(testLogger); }
public static void AdvInfo(this IDHLog log, object sender, object message) { if (!log.IsAdvanced) { return; } log.Info(sender, message); }
public static void Log(this IDHLog log, object sender, object message, Exception exception, LogMessageType logMessageType) { Type logType = null; if (sender != null) { if (sender is string) { log.Log(sender as string, message, exception, logMessageType); return; } logType = sender as Type ?? sender.GetType(); } log.Log(logType, message, exception, logMessageType); }
/// <summary> /// Set custom logger /// </summary> /// <param name="customLog">Custom logger</param> public static void SetCustomLogger(IDHLog customLog) { internalLog = customLog; }
public static void Info(this IDHLog log, object sender, object message) { log.Log(sender, message, LogMessageType.Info); }
public static void Debug(this IDHLog log, object message) { log.Debug(string.Empty, message); }
public static void Debug(this IDHLog log, object sender, object message) { log.Log(sender, message, LogMessageType.Debug); }
public static void Error(this IDHLog log, object message) { log.Error(string.Empty, message); }
public static void AdvInfo(this IDHLog log, object message) { log.AdvInfo(string.Empty, message); }
public static void Error(this IDHLog log, object sender, object message) { Exception exception = message as Exception; log.Log(sender, message, LogMessageType.Error); }
public static void Error(this IDHLog log, Exception exception) { log.Log(string.Empty, exception, LogMessageType.Error); }
public static void Log(this IDHLog log, object message, LogMessageType logMessageType) { log.Log(string.Empty, message, logMessageType); }
public static void Warn(this IDHLog log, object message) { log.Warn(string.Empty, message); }
public static void Warn(this IDHLog log, object sender, object message) { log.Log(sender, message, LogMessageType.Warning); }
protected virtual void ConfigureCustomLogger() { customLogger = Substitute.For <IDHLog>(); LogProvider.SetCustomLogger(customLogger); }
public static void Error(this IDHLog log, object sender, object message, Exception exception) { log.Log(sender, message, exception, LogMessageType.Error); }