예제 #1
0
        public DialogResult ShowView()
        {
            _Presenter = Factory.Resolve <IStatisticsPresenter>();
            _Presenter.Initialise(this);

            return(DialogResult.OK);
        }
        public void TestInitialise()
        {
            _ClassFactorySnapshot = Factory.TakeSnapshot();

            _Statistics = TestUtilities.CreateMockSingleton <IStatistics>();
            _Statistics.Setup(r => r.Lock).Returns(new object());
            _HeartbeatService = TestUtilities.CreateMockSingleton <IHeartbeatService>();

            _Statistics.Setup(r => r.AdsbTypeCount).Returns(new long[256]);
            _Statistics.Setup(r => r.ModeSDFCount).Returns(new long[Enum.GetValues(typeof(DownlinkFormat)).OfType <DownlinkFormat>().Select(r => (int)r).Max() + 1]);
            _Statistics.Setup(r => r.AdsbMessageFormatCount).Returns(new long[Enum.GetValues(typeof(MessageFormat)).OfType <MessageFormat>().Select(r => (int)r).Max() + 1]);

            _Presenter = Factory.Singleton.Resolve <IStatisticsPresenter>();
            _View      = new Mock <IStatisticsView>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();

            _View.Setup(r => r.AdsbMessageTypeCount).Returns(new long[256]);
            _View.Setup(r => r.ModeSDFCount).Returns(new long[Enum.GetValues(typeof(DownlinkFormat)).OfType <DownlinkFormat>().Select(r => (int)r).Max() + 1]);
            _View.Setup(r => r.AdsbMessageFormatCount).Returns(new long[Enum.GetValues(typeof(MessageFormat)).OfType <MessageFormat>().Select(r => (int)r).Max() + 1]);

            _UtcNow   = DateTime.UtcNow;
            _Provider = new Mock <IStatisticsPresenterProvider>()
            {
                DefaultValue = DefaultValue.Mock
            }.SetupAllProperties();
            _Provider.Setup(r => r.UtcNow).Returns(() => { return(_UtcNow); });
            _Presenter.Provider = _Provider.Object;
        }
예제 #3
0
        /// <summary>
        /// Called after the form has been initialised but before it is shown to the user.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Localise.Form(this);

            _OnlineHelp = new OnlineHelpHelper(this, OnlineHelpAddress.WinFormsStatisticsDialog);

            _Presenter = Factory.Singleton.Resolve <IStatisticsPresenter>();
            _Presenter.Initialise(this);
        }
예제 #4
0
        public void TestInitialise()
        {
            _ClassFactorySnapshot = Factory.TakeSnapshot();

            _Statistics       = StatisticsHelper.CreateLockableStatistics();
            _HeartbeatService = TestUtilities.CreateMockSingleton <IHeartbeatService>();

            _Clock = new ClockMock();
            Factory.Singleton.RegisterInstance <IClock>(_Clock.Object);

            _Presenter = Factory.Singleton.Resolve <IStatisticsPresenter>();
            _View      = TestUtilities.CreateMockInstance <IStatisticsView>();

            _View.Setup(r => r.Statistics).Returns(_Statistics.Object);
            _View.Setup(r => r.AdsbMessageTypeCount).Returns(new long[256]);
            _View.Setup(r => r.ModeSDFStatistics).Returns(new ModeSDFStatistics[32]);
            _View.Setup(r => r.AdsbMessageFormatCount).Returns(new long[Enum.GetValues(typeof(MessageFormat)).OfType <MessageFormat>().Select(r => (int)r).Max() + 1]);
        }
        public void TestInitialise()
        {
            _ClassFactorySnapshot = Factory.TakeSnapshot();

            _Statistics = TestUtilities.CreateMockSingleton<IStatistics>();
            _Statistics.Setup(r => r.Lock).Returns(new object());
            _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>();

            _Statistics.Setup(r => r.AdsbTypeCount).Returns(new long[256]);
            _Statistics.Setup(r => r.ModeSDFCount).Returns(new long[Enum.GetValues(typeof(DownlinkFormat)).OfType<DownlinkFormat>().Select(r => (int)r).Max() + 1]);
            _Statistics.Setup(r => r.AdsbMessageFormatCount).Returns(new long[Enum.GetValues(typeof(MessageFormat)).OfType<MessageFormat>().Select(r => (int)r).Max() + 1]);

            _Presenter = Factory.Singleton.Resolve<IStatisticsPresenter>();
            _View = new Mock<IStatisticsView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();

            _View.Setup(r => r.AdsbMessageTypeCount).Returns(new long[256]);
            _View.Setup(r => r.ModeSDFCount).Returns(new long[Enum.GetValues(typeof(DownlinkFormat)).OfType<DownlinkFormat>().Select(r => (int)r).Max() + 1]);
            _View.Setup(r => r.AdsbMessageFormatCount).Returns(new long[Enum.GetValues(typeof(MessageFormat)).OfType<MessageFormat>().Select(r => (int)r).Max() + 1]);

            _UtcNow = DateTime.UtcNow;
            _Provider = new Mock<IStatisticsPresenterProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();
            _Provider.Setup(r => r.UtcNow).Returns(() => { return _UtcNow; });
            _Presenter.Provider = _Provider.Object;
        }