public DealershipEngine(IDealershipFactory factory, IInputOutputProvider ioProvider)
 {
     this.factory    = factory;
     this.ioProvider = ioProvider;
     this.users      = new List <IUser>();
     this.loggedUser = null;
 }
Esempio n. 2
0
        public DealershipEngine(IDealershipFactory factory, IInputOutputProvider ioProvider, ICommandHandler commandHandler)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            this.factory = factory;

            if (ioProvider == null)
            {
                throw new ArgumentNullException(nameof(ioProvider));
            }

            this.ioProvider = ioProvider;

            if (commandHandler == null)
            {
                throw new ArgumentNullException(nameof(commandHandler));
            }

            this.commandHandler = commandHandler;

            this.users      = new HashSet <IUser>();
            this.loggedUser = null;
        }
Esempio n. 3
0
        public override void Load()
        {
            // Following code fragment automatically binds interfaces to classes:

            //Kernel.Bind(x =>
            //{
            //    x.FromAssembliesInPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
            //    .SelectAllClasses()
            //    .BindDefaultInterface();
            //});

            // Instead of:
            // Bind<IAutomobile>().To<Automobile>();
            // Bind<IAutomobileFactory>().ToFactory().InSingletonScope();
            // etc.

            // Easy way to create factory. No class created, only interface.
            Bind <IAutomobile>().To <Automobile>();
            Bind <IAutomobileFactory>().ToFactory().InSingletonScope();


            // Inject dependency IInputOutputProvider into IWheaterDataProvider
            Bind <IWeatherDataProvider>().To <WeatherDataProvider>();
            Bind <IInputOutputProvider>().To <InputOutputProvider>();
            Bind <IInputOutputProvider>().ToMethod(context =>
            {
                IInputOutputProvider inputOutputProvider = context.Kernel.Get <IInputOutputProvider>(); // Instead of NEW keyword

                return(inputOutputProvider);
            }).WhenInjectedInto <IWeatherDataProvider>();
        }
Esempio n. 4
0
 public DealershipEngine(
     ICommand startCommand,
     IDealershipFactory dealershipFactory,
     IInputOutputProvider inputOutputProvider)
 {
     this.startCommand        = startCommand;
     this.dealershipFactory   = dealershipFactory;
     this.inputOutputProvider = inputOutputProvider;
 }
Esempio n. 5
0
        public GameManager(IInputOutputProvider inputOutputProvider, ISettingsProvider settingsProvider, IFigureProvider figureProvider, IBoard board)
        {
            this.inputOutputProvider = inputOutputProvider;
            this.settingsProvider    = settingsProvider;
            this.figureProvider      = figureProvider;
            this.board = board;

            settings = settingsProvider.GetSettings();
            board.SetBoardSize(settings.BoardWidth, settings.BoardHeight);
        }
Esempio n. 6
0
        public GameManager(IPhraseProvider phraseProvider, IInputOutputProvider inputOutputProvider, INumberGenerator numberGenerator, ISettingsProvider settingsProvider)
        {
            this.phraseProvider      = phraseProvider;
            this.inputOutputProvider = inputOutputProvider;
            this.numberGenerator     = numberGenerator;
            this.settingsProvider    = settingsProvider;

            _settings = settingsProvider.GetSettings();
            phraseProvider.SetLanguage(_settings.LanguageFile);
            isRestarting = false;
        }
Esempio n. 7
0
        public void PrintReports(IInputOutputProvider inputOutputProvider)
        {
            var output = new StringBuilder();

            foreach (var report in this.reports)
            {
                output.AppendLine(report);
                output.AppendLine(new string('#', 20));
            }

            inputOutputProvider.Write(output.ToString());
        }
        public DealershipEngine(ICommandHandler commandHandler, ICommandFactory commandFactory, IInputOutputProvider inputOutputProvider,
                                IReportsProvider reportsProvider)
        {
            Guard.WhenArgument(commandHandler, "commandHandler").IsNull().Throw();
            Guard.WhenArgument(inputOutputProvider, "inputOutputProvider").IsNull().Throw();
            Guard.WhenArgument(commandFactory, "commandFactory").IsNull().Throw();
            Guard.WhenArgument(reportsProvider, "reportsProvider").IsNull().Throw();

            this.commandHandler      = commandHandler;
            this.inputOutputProvider = inputOutputProvider;
            this.commandFactory      = commandFactory;
            this.reportsProvider     = reportsProvider;
        }
Esempio n. 9
0
        public DealershipEngine(
            IInputOutputProvider provider,
            ICommentFactory commentFactory,
            ICommandFactory commandFactory,
            IUserFactory userFactory,
            IVehicleFactory vehicleFactory)
        {
            this.provider       = provider;
            this.commentFactory = commentFactory;
            this.commandFactory = commandFactory;
            this.userFactory    = userFactory;
            this.vehicleFactory = vehicleFactory;

            this.users      = new Collection <IUser>();
            this.loggedUser = null;
        }
Esempio n. 10
0
        public DealershipEngine(
            IInputOutputProvider provider,
            ICommentFactory commentFactory,
            ICommandFactory commandFactory,
            IUserFactory userFactory,
            IVehicleFactory vehicleFactory)
        {
            this.provider = provider;
            this.commentFactory = commentFactory;
            this.commandFactory = commandFactory;
            this.userFactory = userFactory;
            this.vehicleFactory = vehicleFactory;

            this.users = new Collection<IUser>();
            this.loggedUser = null;
        }
Esempio n. 11
0
 public WeatherDataProvider(IInputOutputProvider inputOutputProvider)
 {
     this.inputOutputProvider = inputOutputProvider;
 }
Esempio n. 12
0
 public Engine(StudentData studentData, IInputOutputProvider inputOutputProvider)
 {
     this.studentData         = studentData;
     this.inputOutputProvider = inputOutputProvider;
 }
Esempio n. 13
0
 public Engine(StudentSystem students, IInputOutputProvider inputOutputProvider)
 {
     this.studentSystem       = students;
     this.inputOutputProvider = inputOutputProvider;
 }
Esempio n. 14
0
 public WebServer(IInputOutputProvider inputOutputProvider, IResponseProvider responseProvider)
 {
     this.inputOutputProvider = inputOutputProvider;
     this.responseProvider    = responseProvider;
 }
Esempio n. 15
0
 /// <summary>
 /// Constructor with which you can supply a single input/output source
 /// </summary>
 /// <param name="inputOutput">The input/output provider</param>
 public Interpreter(IInputOutputProvider inputOutput, String program = "")
     : this(inputOutput, inputOutput, program)
 {
 }
 public DealershipEngine(IDealershipFactory dealershipFactory, ICommandHandlerProcessor commandHandler, IInputOutputProvider inputOutputProvider)
 {
     this.dealershipFactory   = dealershipFactory;
     this.commandHandler      = commandHandler;
     this.inputOutputProvider = inputOutputProvider;
 }