public void AddSugar()
 {
     var sugar = new Sugar { BloodSugar = 110 };
     factories.CreateSugar().Returns(sugar).AndDoes(_ => factories.Sugars.Add(sugar));
     sut.Load();
     var command = new JournalViewModel.AddSugarCommand();
     sut.Add(command);
     sugarEditing.Received().Show(Arg.Is<SugarViewModel>(vm => "110" == vm.BloodSugar));
     Assert.AreEqual(1, sut.Items.Count);
     navigator.DidNotReceive().GoToNewInsulin();
 }
 public void AddSugarAndSugarEditingCancel()
 {
     var sugar = new Sugar();
     factories.CreateSugar().Returns(sugar).AndDoes(_ => factories.Sugars.Add(sugar));
     sut.Load();
     var command = new JournalViewModel.AddSugarCommand();
     sut.Add(command);
     sugarEditing.Cancel.Call();
     Assert.IsEmpty(factories.Sugars);
     Assert.IsEmpty(sut.Items);
 }
Esempio n. 3
0
 private void Add_Click(object sender, EventArgs e)
 {
     AddCommand command = new DefaultAddCommand();
     if (sender == insulinIcon)
         command = new JournalViewModel.AddInsulinCommand();
     if (sender == sugarIcon)
         command = new JournalViewModel.AddSugarCommand();
     if (sender == addIcon && Pivot.SelectedItem == Journal)
         command = new JournalViewModel.AddMealCommand();
     subConnector.Add(command);
 }