コード例 #1
0
        public Cup GetCoffee()
        {
            Cup cup = _coffeeService.GetCoffee();

            cup.ingredients.Add("Cream");
            return(cup);
        }
コード例 #2
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            int.TryParse(CoffeeId, out var result);

            BindingContext = await coffeeService.GetCoffee(result);
        }
コード例 #3
0
        public void GetIngredients()
        {
            var cup = _coffeeService.GetCoffee();

            foreach (string ingredient in cup.ingredients)
            {
                Console.WriteLine("- " + ingredient);
            }
        }
コード例 #4
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"));
        }
コード例 #5
0
        async Task Refresh()
        {
            IsBusy = true;

#if DEBUG
            await Task.Delay(500);
#endif

            Coffee.Clear();

            var coffees = await coffeeService.GetCoffee();

            Coffee.AddRange(coffees);

            IsBusy = false;

            DependencyService.Get <IToast>()?.MakeToast("Refreshed!");
        }