Beispiel #1
0
        public void NumberOfRecordsShouldIncreaseWhenIAddRecord()
        {
            var userName = "******";
            var service  = new PerfectLifeWebServiceClient();

            var records1 = service.GetRecords(userName).Result.Count;

            var record = new WeightRecord(userName, 80);
            var result = service.AddRecord(record);

            Assert.Equal(HttpStatusCode.OK, result.Result);

            var records2 = service.GetRecords(userName).Result.Count;

            Assert.Equal(records1 + 1, records2);
        }
        async void OnCalculateButtonClicked(object sender, EventArgs args)
        {
            var weightWithUnit = weightPicker.Items[weightPicker.SelectedIndex];
            var weight         = int.Parse(weightWithUnit.Substring(0, weightWithUnit.Length - 3));

            calculateButton.IsEnabled   = false;
            activityIndicator.IsRunning = true;
            weightPicker.IsEnabled      = false;

            var client = new PerfectLifeWebServiceClient();
            await client.AddRecord(new WeightRecord(userName : App.User.Email, weight : weight));

            resultLabel.Text = $"Dzięki. Twoja waga została zapisana!";

            activityIndicator.IsRunning = false;
            calculateButton.IsEnabled   = true;
            weightPicker.IsEnabled      = true;
        }