public void Constructor_CollectorReturns4Items_SutHolds4Items()
        {
            _itemCollector.GetAll("Henrik").Returns(new List<Item>() { new Item(), new Item(), new Item(), new Item() });
            _shoppingListModel = new ScheduledShoppingListModel(_itemCollector, _scheduler, _loginModel);
            _sut = new ShoppingListViewModel(_shoppingListModel);

            Assert.That(_sut.ShoppingList.Count, Is.EqualTo(4));
        }
        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 Constructor_ModelParameterIsNull_ArgumentNullExceptionThrown()
 {
     Assert.Throws <ArgumentNullException>(() => _uut = new ShoppingListViewModel(null));
 }
 public void SetUp()
 {
     _shoppingListModel = Substitute.For<IShoppingListModel>();
     _shoppingListModel.ShoppingList.Returns(new List<Item>() {new Item()});
     _uut = new ShoppingListViewModel(_shoppingListModel);
 }
 public void Constructor_LoginModelUsernameIsHenrik_ItemCollectorGetAllIsCalled()
 {
     _shoppingListModel = new ScheduledShoppingListModel(_itemCollector, _scheduler, _loginModel);
     _sut = new ShoppingListViewModel(_shoppingListModel);
     _itemCollector.Received().GetAll("Henrik");
 }