コード例 #1
0
        public RootPageModel(AppState appState)
        {
            _appState = appState;
            _appState.PropertyChanged += OnAppStatePropertyChanged;

            AddItemCommand = new Command(() =>
            {
                var item = appState.AddNewItem();
                appState.SelectItem(item);
            });

            DeleteItemCommand = new Command(
                () => appState.DeleteItem(appState.SelectedItem),
                () => (appState.SelectedItem != null)
                );
        }
コード例 #2
0
		public void AddNewItem_DoesAddItem()
		{
			var sut = new AppState();
			sut.AddNewItem();
			Assert.Single(sut.Items);
		}