コード例 #1
0
 public void Delete()
 {
     var sut = new MealItemEditingViewModel();
     var needToDelete = false;
     sut.StateProvider = stateProvider;
     sut.NeedToDelete += delegate { needToDelete = true; };
     sut.ChangesProperty("IsVisible", () => sut.Delete.Call());
     Assert.IsTrue(needToDelete);
     Assert.IsFalse(sut.IsVisible);
     Assert.IsFalse(stateProvider.State.ContainsKey(MealItemEditingViewModel.MEAL_ITEM));
 }
コード例 #2
0
 public void Confirm()
 {
     var sut = new MealItemEditingViewModel();
     var confirmed = false;
     sut.StateProvider = stateProvider;
     sut.Confirmed += delegate { confirmed = true; };
     sut.ChangesProperty("IsVisible", () => sut.Confirm.Call());
     Assert.IsTrue(confirmed);
     Assert.IsFalse(sut.IsVisible);
     Assert.IsFalse(stateProvider.State.ContainsKey(MealItemEditingViewModel.MEAL_ITEM));
 }
コード例 #3
0
 public void Show()
 {
     var sut = new MealItemEditingViewModel();
     var model = new MealItem { Value = 5 };
     var mealItem = new MealItemViewModel(model, Substitute.For<Factories>());
     var needToShow = false;
     stateProvider.State[MealItemEditingViewModel.MEAL_ITEM] = model.Serialize(string.Empty);
     model.Value = 1;
     sut.StateProvider = stateProvider;
     sut.NeedToShow += delegate { needToShow = true; };
     sut.ChangesProperty("IsVisible", () => sut.Show(mealItem));
     Assert.AreEqual("5", sut.Subject.Value);
     Assert.IsTrue(needToShow);
     Assert.IsTrue(sut.IsVisible);
 }