public void Setup() { //Setup mocks _recipeCollector = Substitute.For <IRecipeCollector>(); _imageChooser = Substitute.For <IImageChooser>(); //Setup reals _model = new RecipeListModel(_recipeCollector); _sut = new AddRecipeWindowViewModel(_model, _imageChooser); }
/// <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(); }
/// <summary> /// create a window in order to update a recipe /// </summary> /// <param name="recipe">recipe to update</param> public AddRecipeWindow(Recipe recipe) { InitializeComponent(); DataContext = new AddRecipeWindowViewModel(recipe); }
/// <summary> /// create a window in order to create a Recipe /// </summary> public AddRecipeWindow() { InitializeComponent(); DataContext = new AddRecipeWindowViewModel(null); }
public void Setup() { _imageChooser = Substitute.For <IImageChooser>(); _model = Substitute.For <IRecipeListModel>(); _uut = new AddRecipeWindowViewModel(_model, _imageChooser); }