Esempio n. 1
0
        public void SetUp()
        {
            //Setup mocks
            _foodplanCollector = Substitute.For <IFoodplanCollector>();
            _recipeCollector   = Substitute.For <IRecipeCollector>();
            _msgService        = Substitute.For <IMessageBoxService>();
            _itemCollector     = Substitute.For <IItemCollector>();
            _userCollector     = Substitute.For <IUserCollector>();

            //Setup reals
            _scheduler         = new TimerScheduler(2);
            _loginModel        = new LoginModel(_userCollector);
            _recipeListModel   = new RecipeListModel(_recipeCollector);
            _shoppingListModel = new ScheduledShoppingListModel(_itemCollector, _scheduler, _loginModel);
            _foodplanModel     = new FoodplanModel(_foodplanCollector, _shoppingListModel, _recipeListModel, _loginModel, _msgService);
            _sut = new FoodplanViewModel(_foodplanModel)
            {
                Foodplan = new ObservableCollection <Recipe>()
            };
            _foodplanModel.Foodplan.RecipeList = new List <Tuple <Recipe, DateTime> >();

            //Login with Henrik
            _userCollector.DoesUserExist("", "").ReturnsForAnyArgs(true);
            _loginModel.Login("Henrik", "secret");
        }
 public void SetUp()
 {
     _foodplanModel = Substitute.For <IFoodplanModel>();
     _uut           = new FoodplanViewModel(_foodplanModel)
     {
         Foodplan = new ObservableCollection <Recipe>()
     };
 }
 /// <summary>
 /// Sets upp all the ViewModels and Models
 /// </summary>
 public ViewModelLocator()
 {
     _messageBoxService = new MessageBoxService();
     _loginModel        = new LoginModel(new UserHttpCollector(5));
     _foodplanCollector = new FoodplanHttpCollector();
     _loginViewModel    = new LoginViewModel(_loginModel, _messageBoxService, new WindowOpeningService());
     _recipeListModel   = new RecipeListModel(new RecipeHTTPCollector());
     _shoppingListModel = new ScheduledShoppingListModel
                              (new ItemHttpCollector(), new TimerScheduler(60), _loginModel);
     _shoppingListViewModel = new ShoppingListViewModel(_shoppingListModel);
     _foodplanModel         = new FoodplanModel
                                  (_foodplanCollector, _shoppingListModel, _recipeListModel, _loginModel, _messageBoxService);
     _recipeViewModel          = new RecipeListViewModel(_recipeListModel, 300, _foodplanModel, _messageBoxService);
     _addRecipeWindowViewModel = new AddRecipeWindowViewModel(_recipeListModel, new DialogImageChooser());
     _foodplanViewModel        = new FoodplanViewModel(_foodplanModel);
     _mwmvvm = new MainWindowViewModel();
 }