// All shared initialization public static void Init() { SimpleConfigurator.ConfigureForConsoleLogging(LogLevel.Info); // Doesnt seem to work anymore?! SetupNlog.Initialize("Test Runner"); CommonBase.AssemblyLoader = GetAssemblyLoader(); // Use to Reset the various common instances // Normally the EA instance is created in the AppBootStrapper, and Dependency injected into ShellViewModel Common.App = new Common.AppCommon(); Common.Paths = new PathConfiguration(); // Must set AppPath to curdir, otherwise we end up somewhere in test heaven // Also keep the test configuration and temp data separate from production Common.App.InitLocalWithCleanup("Test Runner"); var ea = new EventAggregator(); Cheat.SetServices(new CheatImpl(ea, new Mediator(null, null))); DomainEvilGlobal.Settings = new UserSettings(); /* * Tools.RegisterServices(new ToolsServices(new ProcessManager(), * new Lazy<IWCFClient>(() => new WCFClient()), * new Lazy<IGeoIpService>(() => new GeoIpService()), new CompressionUtil())); */ ReSetupTools(); if (!SingleSetup) { new AssemblyHandler().Register(); SingleSetup = true; } }
protected override void AfterSetup() { base.AfterSetup(); Cheat.SetServices(Container.GetInstance <ICheatImpl>()); CalculatedGameSettings.RaiseEvent = Cheat.PublishEvent; CalculatedGameSettings.NotifyEnMass = async(message) => { await Cheat.PublishDomainEvent((dynamic)message).ConfigureAwait(false); Cheat.PublishEvent(message); }; SetupSettings(); DomainEvilGlobal.SelectedGame = Container.GetInstance <EvilGlobalSelectedGame>(); var authProviderStorage = Container.GetInstance <IAuthProviderStorage>(); var authProvider = Container.GetInstance <IAuthProvider>(); PwsUriHandler.GetAuthInfoFromUri = authProvider.GetAuthInfoFromUri; PwsUriHandler.SetAuthInfo = authProviderStorage.SetAuthInfo; var gameContext = Container.GetInstance <IGameContext>(); var recentGameSet = DomainEvilGlobal.Settings.GameOptions.RecentGameSet; DomainEvilGlobal.SelectedGame.ActiveGame = recentGameSet == null ? FindFirstInstalledGameOrDefault(gameContext) : gameContext.Games.Find(recentGameSet.Id) ?? FindFirstInstalledGameOrDefault(gameContext); }
protected virtual void ConfigureUiInstances() { AppBootstrapperExt.StartSQLite(); RequestScopeService.Instance = new RequestScopeService(Container); var bridge = Container.GetInstance <IBridge>(); GameContextJsonImplementation.Settings = bridge.GameContextSettings(); Cheat.SetServices(Container.GetInstance <ICheatImpl>()); Tools.FileTools.FileOps.ShouldRetry = async(s, s1, e) => { var result = await UserErrorHandler.HandleUserError(new UserErrorModel(s, s1, RecoveryCommands.YesNoCommands, null, e)); return(result == RecoveryOptionResultModel.RetryOperation); }; Tools.InformUserError = (s, s1, e) => UserErrorHandler.HandleUserError(new InformationalUserError(e, s1, s)); _initializers = Container.GetAllInstances <IInitializer>(); }