Esempio n. 1
0
        public async Tasks.Task ChangingFilterRefreshesList()
        {
            DataAccessTestable dataAccessTestable = new DataAccessTestable();

            TimeCollectionViewModel viewModel = new TimeCollectionViewModel();

            viewModel.DataAccess = dataAccessTestable;

            // Load
            await viewModel.LoadTimes();

            // Subscribe to update
            bool retrieved = false;

            dataAccessTestable.addRetrieveEntitiesHandler((q, e, b) =>
            {
                retrieved = true;
            });

            // change filter
            await viewModel.IncrementDateFilter();

            // Verify updated
            Assert.IsTrue(retrieved);
        }
Esempio n. 2
0
        public async Tasks.Task HasItemsFalseWhenNoEntriesExist()
        {
            TimeCollectionViewModel vm = new TimeCollectionViewModel();

            vm.DataAccess = new DataAccessTestable();

            // DataAccessTestable gives back an empty list of entities by default, no need to add any overrides here.
            await vm.LoadTimes();

            Assert.IsFalse(vm.HasItems);
        }
Esempio n. 3
0
        public async Tasks.Task HasItemsTrueWhenEntriesFound()
        {
            DataAccessTestable da = new DataAccessTestable();

            TimeCollectionViewModel vm = new TimeCollectionViewModel();

            vm.DataAccess = da;

            List <msdyn_timeentry> timeEntries = new List <msdyn_timeentry>();

            timeEntries.Add(new msdyn_timeentry()
            {
                msdyn_date     = DateTime.Today,
                msdyn_duration = 4
            });

            da.setRetrieveEntitiesResult(from entry in timeEntries select(Entity) entry);

            await vm.LoadTimes();

            Assert.IsTrue(vm.HasItems);
        }