Example #1
0
 public EventService(ICoffeeService coffeeBreakService, ISlursCommands slurs, IGovernmentRepository governmentRepository, IGovernmentService governmentService)
 {
     _coffeeBreakService = coffeeBreakService;
     _slurs = slurs;
     _governmentRepository = governmentRepository;
     _governmentService    = governmentService;
 }
Example #2
0
        static void Main(string[] args)
        {
            // Ideally this would be handled via an IOC container of some sort like autofac
            // in the interest of time I'm handling it manually here
            _appSettings             = new ApplicationSettingsService();
            _condimentServiceFactory = new CondimentServiceFactory(_appSettings);
            _paymentService          = new PaymentService();
            _coffeeService           = new CoffeeService(_condimentServiceFactory, _paymentService, _appSettings);

            while (true)
            {
                string input = MainMenu();
                switch (input.ToLowerInvariant())
                {
                case "1":
                    OrderCoffee();
                    break;

                case "2":
                    ReviewOrder();
                    break;

                case "3":
                    CancelOrder();
                    break;

                case "4":
                    Pay();
                    break;

                case "q":
                    return;
                }
            }
        }
 public CoffeeListViewModel(ICoffeeService coffeeService, IFavoriteService favoriteService)
 {
     this.favoriteService = favoriteService;
     this.coffeeService   = coffeeService;
     this.AllCoffees      = new ObservableCollection <CoffeeShop> ();
     this.FavoriteCoffees = new ObservableCollection <CoffeeShop> ();
 }
Example #4
0
 public CoffeeCommands(ICoffeeRepository coffeeRepository, IUserRepository userRepository, ISlackWebApi messageSender, IAuthorizationService adminValidator, ICoffeeService coffeeBreakService)
 {
     _coffeeRepository   = coffeeRepository;
     _userRepository     = userRepository;
     _slack              = messageSender;
     _adminValidator     = adminValidator;
     _coffeeBreakService = coffeeBreakService;
 }
        private void SetUp()
        {
            _appSettingsMock             = new Mock <IApplicationSettingsService>();
            _paymentServiceMock          = new Mock <IPaymentService>();
            _condimentServiceFactoryMock = new Mock <ICondimentServiceFactory>();

            _service = new CoffeeService(_condimentServiceFactoryMock.Object, _paymentServiceMock.Object, _appSettingsMock.Object);
        }
Example #6
0
 public CoffeeController(ICoffeeService coffeeService, IOptionsSnapshot <ApiSettings> apiSettings,
                         ILogger <CoffeeController> logger)
 {
     _coffeeService = coffeeService;
     _cofeelogger   = logger;
     _apiSettings   = apiSettings.Value;
     CheckArguments();
 }
Example #7
0
        private void InitializeFunctionConfiguration()
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddTransient <ICoffeeService, CoffeeService>();
            var serviceProvider = serviceCollection.BuildServiceProvider();

            _coffeeService = serviceProvider.GetService <ICoffeeService>();
        }
Example #8
0
        public CoffeeDetailViewModel(ICoffeeService coffeeService)
        {
            _coffeeService = coffeeService;

            GetDetail = ReactiveCommand.CreateFromObservable <Guid, Unit>(ExecuteGetDetail);

            this.WhenAnyValue(x => x.CoffeeId)
            .Where(x => x != null)
            .InvokeCommand(this, x => x.GetDetail);
        }
 public CoffeeDetailViewModel(ICoffeeService coffeeService)
 {
     NavigatingTo
     .Where(x => x.ContainsKey("Id"))
     .Select(x => x["Id"])
     .Cast <Guid>()
     .SelectMany(coffeeService.Read)
     .Where(x => x != null)
     .ToProperty(this, x => x.Detail, out _detail)
     .DisposeWith(Garbage);
 }
Example #10
0
        public void CoffeeService_GetCoffee_MustReturnTheCupWithTheIngredientsOfCoffeePowderAndHotWater()
        {
            // Initialize DI
            ICoffeeService coffeeService = _kernel.Get <CoffeeService>();

            // Act
            Cup cup = coffeeService.GetCoffee();

            // Assert
            Assert.That(cup.ingredients.Contains("Coffee Powder"));
            Assert.That(cup.ingredients.Contains("Hot Water"));
        }
Example #11
0
        public MyCoffeeViewModel()
        {
            Title = "My Coffee";

            Coffee = new ObservableRangeCollection <Coffee>();


            RefreshCommand  = new AsyncCommand(Refresh);
            AddCommand      = new AsyncCommand(Add);
            RemoveCommand   = new AsyncCommand <Coffee>(Remove);
            SelectedCommand = new AsyncCommand <Coffee>(Selected);

            coffeeService = DependencyService.Get <ICoffeeService>();
        }
Example #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this._coffeeService = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICoffeeService>();

            Task.Run(async() => {
                await _coffeeService.InitializeAsync();
                this.RunOnUiThread(() =>
                {
                    this.ListAdapter = _adapter = new CoffeeListAdapter(this, _coffeeService);
                });
            });
        }
Example #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            this._coffeeService = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<ICoffeeService>();

            Task.Run (async () => {
                await _coffeeService.InitializeAsync();
                this.RunOnUiThread(() =>
                    {
                        this.ListAdapter = _adapter = new CoffeeListAdapter(this, _coffeeService);
                    });
            });
        }
Example #14
0
 public MainViewModel(ICoffeMachineDataSender dataSender, ICoffeeService coffeeService, ICoffeeDataService coffeeDataService)
 {
     _dataSender            = dataSender;
     this.coffeeService     = coffeeService;
     this.coffeeDataService = coffeeDataService;
     SerialNumber           = Guid.NewGuid().ToString().Substring(0, 8);
     MakeCappuccinoCommand  = new DelegateCommand(MakeCappucinno);
     MakeEspressoCommand    = new DelegateCommand(MakeEspresso);
     Logs             = new ObservableCollection <string>();
     _dispatcherTimer = new DispatcherTimer
     {
         Interval = TimeSpan.FromSeconds(2)
     };
     _dispatcherTimer.Tick += DispatcherTimer_Tick;
 }
Example #15
0
        public DrinkCollectionViewModel()
        {
            _viewStackService = Locator.Current.GetService <IPopupViewStackService>();
            _coffeeService    = Locator.Current.GetService <ICoffeeService>();

            CoffeeDetails = ReactiveCommand.CreateFromObservable <DrinkViewModel, Unit>(ExecuteNavigate).DisposeWith(Garbage);

            _coffeeService
            .ChangeSet
            .SubscribeOn(RxApp.TaskpoolScheduler)
            .Transform(x => new DrinkViewModel(x.Id, x.Name, x.Species, x.Regions, x.Image))
            // .Sort(SortExpressionComparer<DrinkViewModel>.Ascending(p => p.Name))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _coffeeList)
            .DisposeMany()
            .Subscribe()
            .DisposeWith(Garbage);
        }
Example #16
0
        public CoffeeListViewModel(IPopupViewStackService parameterViewStackService, ICoffeeService coffeeService)
        {
            _viewStackService = parameterViewStackService;
            _coffeeService    = coffeeService;

            CoffeeDetails = ReactiveCommand.CreateFromObservable <CoffeeCellViewModel, Unit>(ExecuteNavigate);

            Refresh = ReactiveCommand.CreateFromTask(ExecuteRefresh);

            _coffeeService
            .ChangeSet
            .Transform(x => new CoffeeCellViewModel(x.Id, x.Name, x.Species, x.Regions, x.Image))
            .Sort(SortExpressionComparer <CoffeeCellViewModel> .Ascending(p => p.Name))
            .Bind(out _coffeeList)
            .DisposeMany()
            .Subscribe()
            .DisposeWith(Garbage);

            CoffeeDetails = ReactiveCommand.CreateFromObservable <CoffeeCellViewModel, Unit>(ExecuteNavigate).DisposeWith(Garbage);
        }
Example #17
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view     = inflater.Inflate(Resource.Layout.CoffeeListFragment, null);
            var  listView = view.FindViewById <ListView>(Resource.Id.coffee_listview);

            this._coffeeService = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICoffeeService>();

            Task.Run(async() =>
            {
                await _coffeeService.InitializeAsync();
                Activity.RunOnUiThread(() =>
                {
                    listView.Adapter = _adapter = new CoffeeListAdapter(Activity, _coffeeService);
                });
            });

            listView.ItemClick += ListView_ItemClick;

            return(view);
        }
Example #18
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.CoffeeListFragment, null);
            var listView = view.FindViewById<ListView>(Resource.Id.coffee_listview);

            this._coffeeService = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<ICoffeeService>();

            Task.Run(async () =>
            {
                await _coffeeService.InitializeAsync();
                Activity.RunOnUiThread(() =>
                {
                    listView.Adapter = _adapter = new CoffeeListAdapter(Activity, _coffeeService);
                });
            });

            listView.ItemClick += ListView_ItemClick;

            return view;
        }
Example #19
0
 public EventService(ICoffeeService coffeeBreakService, ISlursCommands slurs)
 {
     _coffeeBreakService = coffeeBreakService;
     _slurs = slurs;
 }
 public CoffeesController(ICoffeeService _CoffeeService)
 {
     this._CoffeeService = _CoffeeService;
 }
 public CoffeeListPageViewModel(ICoffeeService coffeeService)
 {
     _coffeeService = coffeeService;
 }
Example #22
0
        public CoffeeListPage()
        {
            InitializeComponent();

            _service = ServiceLocator.Current.GetInstance <ICoffeeService> ();
        }
Example #23
0
 public CoffeeController(ICoffeeService coffeeService)
 {
     this.coffeeService = coffeeService;
 }
Example #24
0
 public CoffeeController(ICoffeeService coffeService)
 {
     _coffeService = coffeService;
 }
Example #25
0
 public CoffeeListViewModel(ICoffeeService coffeeService, INavigationService navigationService)
 {
     _navigationService = navigationService;
     _coffeeService     = coffeeService;
     SelectRecord       = new RelayCommand <Record> (ExecuteSelectRecord);
 }
		public CoffeeTableViewController (IntPtr handle) : base (handle)
		{
			_coffeeService =  Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<ICoffeeService>();
		}
Example #27
0
 public CoffeeTableViewController(IntPtr handle) : base(handle)
 {
     _coffeeService = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICoffeeService>();
 }
Example #28
0
 public RecipeController(ApplicationDbContext context)
 {
     this._context = context;
     this._service = new CoffeeService(context);
 }
Example #29
0
 public EspressoMachineService(ICoffeeService coffeeService)
 {
     this.coffeeService = coffeeService;
 }
Example #30
0
 public ProfileViewVm()
 {
     _coffeeService = new CoffeeService();
 }
 public CoffeeListPageViewModel(ICoffeeService coffeeService)
 {
     _coffeeService = coffeeService;
 }
 public CoffeeListViewModel(ICoffeeService coffeeService, IAlertService alertService)
 {
     this.CoffeeService = coffeeService;
     this.alertService  = alertService;
     LoadCoffeesCommand = new RelayCommand(() => InitializeData());
 }
 public CreamCoffeeService(ICoffeeService coffeeService)
 {
     _coffeeService = coffeeService;
 }
 public CoffeeController(ICoffeeService coffeeService, ILog logger)
 {
     _coffeeService = coffeeService;
     _logger = logger;
 }
Example #35
0
 public CoffeeListAdapter(Activity context, ICoffeeService coffeeService)
 {
     this.coffeeService = coffeeService;
     _context = context;
 }
Example #36
0
 public HistoryChartDataController(ApplicationDbContext context)
 {
     this._context = context;
     this._service = new CoffeeService(context);
 }
Example #37
0
 public CoffeeTableSource(CoffeeTableViewController controller, ICoffeeService coffeeService)
 {
     _controller = controller;
     _coffeeService = coffeeService;
 }