Example #1
0
        public void TestInitialise()
        {
            _ClassFactorySnapshot = Factory.TakeSnapshot();

            _UPnpManager = new Mock <IUniversalPlugAndPlayManager>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
            _BaseStationAircraftList = new Mock <IBaseStationAircraftList>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
            _PluginManager = TestUtilities.CreateMockSingleton <IPluginManager>();
            _Plugins       = new List <IPlugin>();
            _PluginManager.Setup(m => m.LoadedPlugins).Returns(_Plugins);
            _ConnectionLogger              = TestUtilities.CreateMockSingleton <IConnectionLogger>();
            _AutoConfigWebServer           = TestUtilities.CreateMockSingleton <IAutoConfigWebServer>();
            _AutoConfigBaseStationDatabase = TestUtilities.CreateMockSingleton <IAutoConfigBaseStationDatabase>();
            _LogDatabase              = TestUtilities.CreateMockSingleton <ILogDatabase>();
            _AutoConfigListener       = TestUtilities.CreateMockSingleton <IAutoConfigListener>();
            _RebroadcastServerManager = TestUtilities.CreateMockSingleton <IRebroadcastServerManager>();

            // This version of ILog should cause code that catches & logs exceptions to throw on the log write. Without this
            // the Asserts can go unnoticed.
            var uncallableLog = new Mock <ILog>(MockBehavior.Strict);

            Factory.Singleton.RegisterInstance <ILog>(uncallableLog.Object);

            _Presenter = Factory.Singleton.Resolve <IShutdownPresenter>();
            _View      = new Mock <IShutdownView>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
        }
Example #2
0
        /// <summary>
        /// Called after the view has been created but before it is on display to the user.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!DesignMode)
            {
                Localise.Form(this);

                labelProgressText.Text = "";

                _Presenter             = Factory.Singleton.Resolve <IShutdownPresenter>();
                _Presenter.UPnpManager = _UPnpManager;
                _Presenter.Initialise(this);

                backgroundWorker.RunWorkerAsync();
            }
        }
        public void TestInitialise()
        {
            _ClassFactorySnapshot = Factory.TakeSnapshot();

            _UPnpManager = new Mock<IUniversalPlugAndPlayManager>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();
            _BaseStationAircraftList = new Mock<IBaseStationAircraftList>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();
            _PluginManager = TestUtilities.CreateMockSingleton<IPluginManager>();
            _Plugins = new List<IPlugin>();
            _PluginManager.Setup(m => m.LoadedPlugins).Returns(_Plugins);
            _ConnectionLogger = TestUtilities.CreateMockSingleton<IConnectionLogger>();
            _AutoConfigWebServer = TestUtilities.CreateMockSingleton<IAutoConfigWebServer>();
            _AutoConfigBaseStationDatabase = TestUtilities.CreateMockSingleton<IAutoConfigBaseStationDatabase>();
            _LogDatabase = TestUtilities.CreateMockSingleton<ILogDatabase>();
            _AutoConfigListener = TestUtilities.CreateMockSingleton<IAutoConfigListener>();
            _RebroadcastServerManager = TestUtilities.CreateMockSingleton<IRebroadcastServerManager>();

            // This version of ILog should cause code that catches & logs exceptions to throw on the log write. Without this
            // the Asserts can go unnoticed.
            var uncallableLog = new Mock<ILog>(MockBehavior.Strict);
            Factory.Singleton.RegisterInstance<ILog>(uncallableLog.Object);

            _Presenter = Factory.Singleton.Resolve<IShutdownPresenter>();
            _View = new Mock<IShutdownView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();
        }
        /// <summary>
        /// Called after the view has been created but before it is on display to the user.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if(!DesignMode) {
                Localise.Form(this);

                labelProgressText.Text = "";

                _Presenter = Factory.Singleton.Resolve<IShutdownPresenter>();
                _Presenter.BaseStationAircraftList = _BaseStationAircraftList;
                _Presenter.UPnpManager = _UPnpManager;
                _Presenter.Initialise(this);

                backgroundWorker.RunWorkerAsync();
            }
        }