Ejemplo n.º 1
0
            public TestContext()
            {
                MockLandingGearManager = new Mock <ILandingGearManager>();
                MockLandingGearManager
                .Setup(x => x.Blocks.Count)
                .Returns(() => LandingGearCount);

                MockLogger = new Mock <ILogger>();

                MockDockingManagerSettingsProvider = new Mock <IDockingManagerSettingsProvider>();
                MockDockingManagerSettingsProvider
                .Setup(x => x.Settings)
                .Returns(() => new DockingManagerSettings()
                {
                    IgnoreBatteryBlocks  = IgnoreOtherBlocks,
                    IgnoreBeacons        = IgnoreOtherBlocks,
                    IgnoreGasGenerators  = IgnoreOtherBlocks,
                    IgnoreGasTanks       = IgnoreOtherBlocks,
                    IgnoreGyros          = IgnoreOtherBlocks,
                    IgnoreLandingGears   = IgnoreLandingGears,
                    IgnoreLightingBlocks = IgnoreOtherBlocks,
                    IgnoreRadioAntennae  = IgnoreOtherBlocks,
                    IgnoreReactors       = IgnoreOtherBlocks
                });

                Uut = new LandingGearCollectionHandler(
                    MockLandingGearManager.Object,
                    MockLogger.Object,
                    MockDockingManagerSettingsProvider.Object);

                MockBackgroundWorker = new FakeBackgroundWorker();
            }
Ejemplo n.º 2
0
 public CollectLandingGearOperation(
     LandingGearCollectionHandler owner,
     Action onDisposed)
 {
     _owner      = owner;
     _onDisposed = onDisposed;
 }
Ejemplo n.º 3
0
        public Program()
        {
            var dateTimeProvider             = new DateTimeProvider();
            var loggerSettingsProvider       = new LoggerSettingsProvider();
            var managedBlockSettingsProvider = new ManagedBlockSettingsProvider();

            var logger = new Logger(
                dateTimeProvider,
                loggerSettingsProvider);
            var managedBlockConfigParseHandlers = new IManagedBlockConfigParseHandler[]
            {
                managedBlockSettingsProvider
            };
            var managerSettingsProvider = new ManagerSettingsProvider()
            {
                DefaultBlockTag = "AutomatedDocking"
            };

            var batteryBlockManager       = new BatteryBlockManager();
            var connectorManager          = new ConnectorManager();
            var functionalBlockManager    = new FunctionalBlockManager();
            var gasTankManager            = new GasTankManager();
            var landingGearManager        = new LandingGearManager();
            var managedBlockConfigManager = new ManagedBlockConfigManager(
                logger,
                managedBlockConfigParseHandlers,
                managerSettingsProvider);
            var dockingManagerSettingsProvider = new DockingManagerSettingsProvider();

            var batteryBlockCollectionHandler = new BatteryBlockCollectionHandler(
                batteryBlockManager,
                logger,
                dockingManagerSettingsProvider);
            var connectorCollectionHandler = new ConnectorCollectionHandler(
                connectorManager,
                logger);
            var functionalBlockCollectionHandler = new FunctionalBlockCollectionHandler(
                functionalBlockManager,
                logger,
                dockingManagerSettingsProvider);
            var gasTankCollectionHandler = new GasTankCollectionHandler(
                gasTankManager,
                logger,
                dockingManagerSettingsProvider);
            var landingGearCollectionHandler = new LandingGearCollectionHandler(
                landingGearManager,
                logger,
                dockingManagerSettingsProvider);
            var managedBlockCollectionHandler = new ManagedBlockCollectionHandler(
                managedBlockConfigManager,
                managedBlockSettingsProvider,
                managerSettingsProvider,
                Me);

            var backgroundWorkerSettingsProvider = new BackgroundWorkerSettingsProvider();
            var blockCollectionHandlers          = new IBlockCollectionHandler[]
            {
                managedBlockCollectionHandler,
                batteryBlockCollectionHandler,
                connectorCollectionHandler,
                functionalBlockCollectionHandler,
                gasTankCollectionHandler,
                landingGearCollectionHandler
            };

            var backgroundWorker = new BackgroundWorker(
                backgroundWorkerSettingsProvider,
                dateTimeProvider,
                Runtime);
            var blockCollectionManager = new BlockCollectionManager <IMyTerminalBlock>(
                blockCollectionHandlers,
                GridTerminalSystem);

            var programReloadHandler = new ProgramReloadHandler(
                backgroundWorker,
                blockCollectionManager);

            var configParseHandlers = new IConfigParseHandler[]
            {
                backgroundWorkerSettingsProvider,
                loggerSettingsProvider,
                managerSettingsProvider,
                dockingManagerSettingsProvider,
                programReloadHandler
            };

            var configManager = new ConfigManager(
                configParseHandlers,
                logger,
                Me);
            var dockingManager = new DockingManager(
                logger,
                batteryBlockManager,
                connectorManager,
                functionalBlockManager,
                gasTankManager,
                landingGearManager);
            var echoProvider = new EchoProvider(Echo);

            _programManager = new ProgramManager(
                backgroundWorker,
                configManager,
                dockingManager,
                echoProvider,
                Runtime,
                logger);

            _programManager.Run("reload");
        }