Пример #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");
        }
Пример #2
0
        /// <summary>
        /// Sets up the LoginModel with constructor injection
        /// </summary>
        /// <param name="collector">Collector to use</param>
        public LoginModel(IUserCollector collector)
        {
            if (collector == null) throw new ArgumentNullException();

            _collector = collector;
            ShoppinglistId = -1;
            FoodplanId = -1;
        }
Пример #3
0
        public void SetUp()
        {
            //Setup mocks
            _collector = Substitute.For<IUserCollector>();
            _messageService = Substitute.For<IMessageBoxService>();
            _wos = Substitute.For<IWindowOpeningService>();

            //Setup reals
            _model = new LoginModel(_collector);
            _sut = new LoginViewModel(_model, _messageService, _wos);
        }
Пример #4
0
        /// <summary>
        /// Sets up the LoginModel with constructor injection
        /// </summary>
        /// <param name="collector">Collector to use</param>
        public LoginModel(IUserCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException();
            }

            _collector     = collector;
            ShoppinglistId = -1;
            FoodplanId     = -1;
        }
Пример #5
0
        public void SetUp()
        {
            //Setup mocks
            _collector      = Substitute.For <IUserCollector>();
            _messageService = Substitute.For <IMessageBoxService>();
            _wos            = Substitute.For <IWindowOpeningService>();

            //Setup reals
            _model = new LoginModel(_collector);
            _sut   = new LoginViewModel(_model, _messageService, _wos);
        }
        public void SetUp()
        {
            //Setup mocks
            _userCollector = Substitute.For<IUserCollector>();
            _userCollector.GetShoppinglistId("").ReturnsForAnyArgs(5);
            _itemCollector = Substitute.For<IItemCollector>();

            //Setup reals
            _scheduler = new TimerScheduler(2);
            _loginModel = new LoginModel(_userCollector);
            _shoppingListModel = new ScheduledShoppingListModel(_itemCollector, _scheduler, _loginModel);
            _sut = new ShoppingListViewModel(_shoppingListModel);

            //Login with Henrik
            _userCollector.DoesUserExist("", "").ReturnsForAnyArgs(true);
            _loginModel.Login("Henrik", "secret");
        }
        public void SetUp()
        {
            //Setup mocks
            _userCollector = Substitute.For <IUserCollector>();
            _userCollector.GetShoppinglistId("").ReturnsForAnyArgs(5);
            _itemCollector = Substitute.For <IItemCollector>();

            //Setup reals
            _scheduler         = new TimerScheduler(2);
            _loginModel        = new LoginModel(_userCollector);
            _shoppingListModel = new ScheduledShoppingListModel(_itemCollector, _scheduler, _loginModel);
            _sut = new ShoppingListViewModel(_shoppingListModel);

            //Login with Henrik
            _userCollector.DoesUserExist("", "").ReturnsForAnyArgs(true);
            _loginModel.Login("Henrik", "secret");
        }
Пример #8
0
        public void Setup()
        {
            //Setup mocks
            _foodplanCollector = Substitute.For <IFoodplanCollector>();
            _itemCollector     = Substitute.For <IItemCollector>();
            _userCollector     = Substitute.For <IUserCollector>();
            _recipeCollector   = Substitute.For <IRecipeCollector>();

            //Setup reals
            _loginModel        = new LoginModel(_userCollector);
            _shoppingListModel = new ScheduledShoppingListModel
                                     (_itemCollector, new TimerScheduler(60), _loginModel);
            _recipeListModel = new RecipeListModel(_recipeCollector);

            // Uut
            _uut          = new FoodplanModel(_foodplanCollector, _shoppingListModel, _recipeListModel, _loginModel);
            _uut.Foodplan = new Foodplan()
            {
                RecipeList = new List <Tuple <Recipe, DateTime> >()
            };
        }
Пример #9
0
        public void SetUp()
        {
            _recipeSizeWidth = 220;
            //Setup mocks
            _foodplanCollector = Substitute.For <IFoodplanCollector>();
            _recipeCollector   = Substitute.For <IRecipeCollector>();
            _msgService        = Substitute.For <IMessageBoxService>();
            _itemCollector     = Substitute.For <IItemCollector>();
            _userCollector     = Substitute.For <IUserCollector>();
            _shoppingListModel = Substitute.For <IShoppingListModel>();

            //Setup reals
            _loginModel      = new LoginModel(_userCollector);
            _recipeListModel = new RecipeListModel(_recipeCollector);
            _foodplanModel   = new FoodplanModel(_foodplanCollector, _shoppingListModel, _recipeListModel, _loginModel, _msgService);
            _foodplanModel.Foodplan.RecipeList = new List <Tuple <Recipe, DateTime> >();
            _sut = new RecipeListViewModel(_recipeListModel, _recipeSizeWidth, _foodplanModel, _msgService);

            //Login with Henrik
            _userCollector.DoesUserExist("", "").ReturnsForAnyArgs(true);
            _loginModel.Login("Henrik", "secret");
        }
Пример #10
0
        public void SetUp()
        {
            _recipeSizeWidth = 220;
            //Setup mocks
            _foodplanCollector = Substitute.For<IFoodplanCollector>();
            _recipeCollector = Substitute.For<IRecipeCollector>();
            _msgService = Substitute.For<IMessageBoxService>();
            _itemCollector = Substitute.For<IItemCollector>();
            _userCollector = Substitute.For<IUserCollector>();
            _shoppingListModel = Substitute.For<IShoppingListModel>();

            //Setup reals
            _loginModel = new LoginModel(_userCollector);
            _recipeListModel = new RecipeListModel(_recipeCollector);
            _foodplanModel = new FoodplanModel(_foodplanCollector, _shoppingListModel, _recipeListModel, _loginModel, _msgService);
            _foodplanModel.Foodplan.RecipeList = new List<Tuple<Recipe, DateTime>>();
            _sut = new RecipeListViewModel(_recipeListModel, _recipeSizeWidth, _foodplanModel, _msgService);

            //Login with Henrik
            _userCollector.DoesUserExist("", "").ReturnsForAnyArgs(true);
            _loginModel.Login("Henrik", "secret");
        }
Пример #11
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");
        }
Пример #12
0
 public void SetUp()
 {
     _collector = Substitute.For <IUserCollector>();
     _uut       = new LoginModel(_collector);
 }
 public void SetUp()
 {
     _collector = Substitute.For<IUserCollector>();
     _uut = new LoginModel(_collector);
 }