Example #1
0
        public async Task Should_load_all_coffee_on_init()
        {
            _viewModel = new CoffeeListViewModel(
                new CoffeeService(httpProvider),
                new FavoriteServiceMock()
                );

            await dbProvider.InitializeDb();

            await _viewModel.Initialize();

            Assert.IsTrue(_viewModel.AllCoffees.Any());
            foreach (var coffee in _viewModel.AllCoffees)
            {
                Assert.IsFalse(string.IsNullOrEmpty(coffee.Name));
                Assert.IsFalse(string.IsNullOrEmpty(coffee.Id));
            }
        }
Example #2
0
        public async Task Should_load_favorite_coffees_at_init()
        {
            _viewModel = new CoffeeListViewModel(
                new CoffeeServiceMock(new List <CoffeeShop> {
                new CoffeeShop {
                    Id = "test"
                }
            }),
                new FavoriteService(dbProvider)
                );

            await dbProvider.InitializeDb();

            await dbProvider.GetConnection().AddToDb(new FavoriteRow {
                FavoriteId = "test"
            });

            await _viewModel.Initialize();

            Assert.IsTrue(_viewModel.FavoriteCoffees.Count(f => f.Id == "test") == 1);
        }