Example #1
0
        //Refresh the list with the items in the local store.
        private async Task RefreshItemsFromTableAsync()
        {
            try
            {
                GetEnergy();
                var    breakfastEnergy = userData.Energy * 0.35;
                var    lunchEnergy     = userData.Energy * 0.45;
                var    dinnerEnergy    = userData.Energy * 0.2;
                string toast           = string.Format("Potrzebujesz {0} kcal", userData.Energy);
                Toast.MakeText(this, toast, ToastLength.Long).Show();
                adapter.Clear();
                var breakfast = await GetMealDescriptionAsync("Śniadanie", breakfastEnergy);

                adapter.Add(breakfast);
                var lunch = await GetMealDescriptionAsync("Obiad", lunchEnergy);

                adapter.Add(lunch);
                var dinner = await GetMealDescriptionAsync("Kolacja", dinnerEnergy);

                adapter.Add(dinner);
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e, "Error");
            }
        }
Example #2
0
        public void Add_ShouldReturnResult()
        {
            int start  = 4;
            int amount = 2;
            int result = _calculatorAdapter.Add(start, amount);

            Assert.Equal(6, result);
        }
Example #3
0
        static void Main(string[] args)
        {
            CalculatorAdapter calculator = new CalculatorAdapter();

            Console.WriteLine(calculator.Add(12, 35));
            Console.WriteLine(calculator.Substract(80, 40));
            Console.WriteLine(calculator.Multiply(12, 35));
            Console.WriteLine(calculator.Divide(70, 35));
            Console.ReadKey();
        }