Beispiel #1
0
        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);
        }
Beispiel #3
0
        public static void AdvInfo(this IDHLog log, object sender, object message)
        {
            if (!log.IsAdvanced)
            {
                return;
            }

            log.Info(sender, message);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 /// <summary>
 /// Set custom logger
 /// </summary>
 /// <param name="customLog">Custom logger</param>
 public static void SetCustomLogger(IDHLog customLog)
 {
     internalLog = customLog;
 }
Beispiel #6
0
 public static void Info(this IDHLog log, object sender, object message)
 {
     log.Log(sender, message, LogMessageType.Info);
 }
Beispiel #7
0
 public static void Debug(this IDHLog log, object message)
 {
     log.Debug(string.Empty, message);
 }
Beispiel #8
0
 public static void Debug(this IDHLog log, object sender, object message)
 {
     log.Log(sender, message, LogMessageType.Debug);
 }
Beispiel #9
0
 public static void Error(this IDHLog log, object message)
 {
     log.Error(string.Empty, message);
 }
Beispiel #10
0
 public static void AdvInfo(this IDHLog log, object message)
 {
     log.AdvInfo(string.Empty, message);
 }
Beispiel #11
0
        public static void Error(this IDHLog log, object sender, object message)
        {
            Exception exception = message as Exception;

            log.Log(sender, message, LogMessageType.Error);
        }
Beispiel #12
0
 public static void Error(this IDHLog log, Exception exception)
 {
     log.Log(string.Empty, exception, LogMessageType.Error);
 }
Beispiel #13
0
 public static void Log(this IDHLog log, object message, LogMessageType logMessageType)
 {
     log.Log(string.Empty, message, logMessageType);
 }
Beispiel #14
0
 public static void Warn(this IDHLog log, object message)
 {
     log.Warn(string.Empty, message);
 }
Beispiel #15
0
 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);
 }
Beispiel #17
0
 public static void Error(this IDHLog log, object sender, object message, Exception exception)
 {
     log.Log(sender, message, exception, LogMessageType.Error);
 }