private static LinesSourceManager CreateManager(ISelkieLogger logger,
                                                 ISelkieBus bus)
 {
     return CreateManager(logger,
                          bus,
                          Substitute.For <ISelkieInMemoryBus>());
 }
Exemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ISelkieLogger logger = null;

            try
            {
                logger = Container.Resolve <ISelkieLogger>();

                // ReSharper disable once UnusedVariable
                var factory = Container.Resolve <IViewFactory>();
                var main    = factory.CreateView <IMainView>();
                main.ShowDialog();
            }
            catch (Exception exception)
            {
                string message = LogException(logger,
                                              exception);

                MessageBox.Show(message);

                Console.WriteLine(exception);
                Console.WriteLine(exception.StackTrace);

                if (logger != null)
                {
                    logger.Error(message,
                                 exception);
                }
            }
        }
        protected override void OnStartup(object sender,
                                          StartupEventArgs e)
        {
            PrePopulateRepositories();
            Logger = m_Container.Resolve <ISelkieLogger>();

            ConfigureAndDisplayRootView();
        }
Exemplo n.º 4
0
 public CarPark([NotNull] ISelkieLogger logger,
                [NotNull] IBaysManagerFactory factory,
                [NotNull] string name,
                int numberOfBays)
 {
     Logger        = logger;
     Factory       = factory;
     Name          = name;
     m_BaysManager = factory.Create(numberOfBays);
 }
        public PaddocksService(
            [NotNull] ISelkieLogger logger,
            [NotNull] IEventAggregator eventAggregator,
            [NotNull] IPaddocksRepository paddocksRepository)
            : base(logger)
        {
            m_EventAggregator    = eventAggregator;
            m_PaddocksRepository = paddocksRepository;

            m_EventAggregator.Subscribe(this);
        }
        public void Stop_LogsText_WhenCalled(
            [NotNull][Frozen] ISelkieLogger logger,
            [NotNull] TestBaseRepository sut)
        {
            // Arrange
            // Act
            sut.Stop();

            // Assert
            logger.Received().Info(Arg.Any <string>());
        }
Exemplo n.º 7
0
        public MillersService(
            [NotNull] ISelkieLogger logger,
            [NotNull] IEventAggregator eventAggregator,
            [NotNull] IMillersRepository millersRepository)
            : base(logger)
        {
            m_EventAggregator   = eventAggregator;
            m_MillersRepository = millersRepository;

            m_EventAggregator.Subscribe(this);
        }
Exemplo n.º 8
0
        public FarmsViewModel(
            [NotNull] IEventAggregator eventAggregator,
            [NotNull] ISelkieLogger logger)
        {
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            AvailableFarms = new BindableCollection <IFarmMillerViewModel>();

            m_EventAggregator.Subscribe(this);

            m_EventAggregator.PublishOnBackgroundThread(new FarmsMillersRequestEvent());
        }
        private static LinesSourceManager CreateManager(ISelkieLogger logger,
                                                        ISelkieBus bus,
                                                        ISelkieInMemoryBus inMemoryBus)
        {
            var factory = Substitute.For <ILinesSourceFactory>();
            factory.Create(Arg.Any <IEnumerable <ILine>>()).Returns(CreateLinesSource);

            var converter = new TestLinesDtoToLinesConverter();

            return new LinesSourceManager(logger,
                                          bus,
                                          inMemoryBus,
                                          factory,
                                          converter);
        }
Exemplo n.º 10
0
        private string LogException(ISelkieLogger logger,
                                    Exception exception)
        {
            string message = "Failed to create components: {0}\r\n\r\n{1}".Inject(exception.Message,
                                                                                  exception.StackTrace);

            logger.Error(message);

            if ( exception.InnerException != null )
            {
                message += LogException(logger,
                                        exception.InnerException);
            }

            return message;
        }
Exemplo n.º 11
0
        private string LogException(ISelkieLogger logger,
                                    Exception exception)
        {
            string message = "Failed to create components: {0}\r\n\r\n{1}".Inject(exception.Message,
                                                                                  exception.StackTrace);

            logger.Error(message);

            if (exception.InnerException != null)
            {
                message += LogException(logger,
                                        exception.InnerException);
            }

            return(message);
        }
        public CalculateCostMatrixManager([NotNull] ISelkieLogger logger,
                                          [NotNull] ISelkieBus bus,
                                          [NotNull] ILinesSourceManager linesSourceManager,
                                          [NotNull] IRacetrackSettingsSourceManager racetrackSettingsSourceManager)
        {
            m_Logger = logger;
            m_Bus = bus;
            m_LinesSourceManager = linesSourceManager;
            m_RacetrackSettingsSourceManager = racetrackSettingsSourceManager;

            string subscriptionId = GetType().FullName;

            m_Bus.SubscribeAsync <ColonyLinesChangedMessage>(subscriptionId,
                                                             ColonyLinesChangedHandler);

            m_Bus.SubscribeAsync <ColonyRacetrackSettingsChangedMessage>(subscriptionId,
                                                                         ColonyRacetrackSettingsChangedHandler);
        }
        public CostMatrixSourceManager([NotNull] ISelkieLogger logger,
                                       [NotNull] ISelkieBus bus,
                                       [NotNull] ICalculateCostMatrixManager calculateCostMatrixManager,
                                       [NotNull] IDoubleArrayToIntegerArrayConverter converter)
        {
            m_Logger = logger;
            m_Bus = bus;
            m_CalculateCostMatrixManager = calculateCostMatrixManager;
            m_Converter = converter;

            string subscriptionId = GetType().FullName;

            m_Bus.SubscribeAsync <CostMatrixChangedMessage>(subscriptionId,
                                                            CostMatrixChangedHandler);

            m_Bus.SubscribeAsync <ColonyLinesChangedMessage>(subscriptionId,
                                                             ColonyLinesChangedHandler);

            m_Bus.SubscribeAsync <ColonyRacetrackSettingsChangedMessage>(subscriptionId,
                                                                         ColonyRacetrackSettingsChangedHandler);

            m_CalculateCostMatrixManager.Calculate();
        }
Exemplo n.º 14
0
 public BaseService(
     [NotNull] ISelkieLogger logger)
 {
     Logger = logger;
 }
 public TestBaseRepository(
     [NotNull] ISelkieLogger logger)
     : base(logger)
 {
 }
 public PaddocksRepository([NotNull] ISelkieLogger logger)
     : base(logger)
 {
 }
Exemplo n.º 17
0
 public FarmsRepository([NotNull] ISelkieLogger logger)
     : base(logger)
 {
 }
Exemplo n.º 18
0
 protected BaseRepository(
     [NotNull] ISelkieLogger logger)
 {
     Logger = logger;
 }
Exemplo n.º 19
0
 public MillersRepository([NotNull] ISelkieLogger logger)
     : base(logger)
 {
 }