public void CanAddTransactionWhenNoItemsSelectedTest()
        {
            //Arrange
            var itemA = new Item { Name = "apple" };
            var itemB = new Item { Name = "orange" };

            _target.Items = new ObservableSet<Item> { itemA, itemB };

            //Assert
            Assert.IsFalse(_target.AddTransaction.CanExecute(null));
        }
        public void CanAddTransactionTest()
        {
            //Arrange
            var itemA = new Item { Name = 'a', Selected = true };
            var itemB = new Item { Name = 'b' };

            _target.Items = new ObservableSet<Item> { itemA, itemB };

            //Assert
            Assert.IsTrue(_target.AddTransaction.CanExecute(null));
        }
        public void AddTransactionTest()
        {
            //Arrange
            var itemA = new Item { Name = "apple" };
            var itemB = new Item { Name = "orange" };
            var itemC = new Item { Name = "pear", Selected = true };

            _target.Items = new ObservableSet<Item> { itemA, itemB, itemC };

            //Act
            _target.AddTransaction.Execute(null);

            //Assert
            Assert.AreEqual(1, _target.Transactions.Count);
            Assert.AreEqual("ac", _target.Transactions[0]);
        }
        public void RemoveItemTest()
        {
            //Arrange
            var itemA = new Item { Name = "apple" };
            var itemB = new Item { Name = "orange" };

            _target.Items = new ObservableSet<Item> { itemA, itemB };

            //Act
            _target.SelectedItem = itemA;
            _target.RemoveItem.Execute(null);

            //Assert
            Assert.AreEqual(1, _target.Items.Count);
            Assert.AreEqual(itemB.Name, _target.Items[0].Name);
        }
        public void RemoveItemInTransactionTest()
        {
            //Arrange
            var itemA = new Item { Name = "apple" };
            var itemB = new Item { Name = "orange" };
            _target.Items = new ObservableSet<Item> { itemA, itemB };
            string transaction = itemA.Name + "" + itemB.Name;
            _target.Transactions = new ObservableCollection<string> { transaction };

            //Act
            _target.SelectedItem = itemA;
            _target.RemoveItem.Execute(null);

            //Assert
            Assert.AreEqual(2, _target.Items.Count);
            Assert.AreNotEqual(string.Empty, _target.Error);
        }