コード例 #1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (_viewModel.Items.Count == 0)
            {
                _viewModel.LoadItems();
            }
        }
コード例 #2
0
        public void LoadItems_Correctly_Modifies_Items_Property()
        {
            var mockDb = new Mock <IDataStore <Item> >();
            var vm     = new ItemsViewModel(mockDb.Object);
            var items  = new List <Item>();

            for (int i = 0; i < 5; i++)
            {
                items.Add(new Item());
            }
            mockDb.Setup(x => x.GetItems()).Returns(items);

            vm.LoadItems();

            Assert.AreEqual(5, vm.Items.Count);
        }