public void StoreNewCard()
        {
            var expected = new Card() { ColumnIndex = 12345, Id = "qwertz", Text = "asdfghjkl" };
            provider.StoreCard(expected);
            var new_board = provider.Load_all_cards();
            var card_from_board = new_board.Single(c => c.Id == expected.Id);
            Assert.AreEqual(expected.Id, card_from_board.Id);

            var loaded_card = provider.LoadCard(expected.Id);
            Assert.AreEqual(expected.Id, loaded_card.Id);
        }
        ////[TestMethod()]
        public void Display_cardsTest()
        {
            BoardPortal form = new BoardPortal();
            List<Card> cards = new List<Card>();

            for(int i = 0; i< 15; i++)
            {
                Card cardToAdd = new Card() { ColumnIndex = i / 4, Id = i.ToString(), Text = "Card \n wwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwww " + i.ToString()};
                cards.Add(cardToAdd);
            }

            form.Display_cards(cards);
            form.ShowDialog();
        }
Exemple #3
0
        public void TestBoard()
        {
            Board target = new Board();

            Card c0 = new Card();
            c0.Id = "0";
            c0.Text = "Card 0";
            c0.ColumnIndex = 0;

            Card c1 = target.Move_card_to_column(c0, 1);
            Assert.AreEqual("0", c1.Id);
            Assert.AreEqual("Card 0", c1.Text);
            Assert.AreEqual(1, c1.ColumnIndex);
        }
        public void StoreCard(Card card)
        {
            _ts.TraceInformation("StoreCard: {0}", card.Id);
            var board = this.Load_all_cards().ToList();
            var existing_card = board.FirstOrDefault(c => c.Id == card.Id);
            if (existing_card == null)
            {
                board.Add(card);
            }
            else
            {
                existing_card.ColumnIndex = card.ColumnIndex;
                existing_card.Text = card.Text;
            }

            using (var stream = new StreamWriter(this.filename))
            {
                this.serializer.Serialize(stream, board);
            }
        }
 public static void Add(Card card)
 {
     cards.Add(card.Id, card);
 }
Exemple #6
0
        /// <summary>
        /// Adds the card to the corresponding tree-view.
        /// </summary>
        /// <param name="card">The card.</param>
        /// <param name="treeView">The tree view.</param>
        private void AddCardToList(Card card, TreeView treeView)
        {
            TreeNode addedNode = treeView.Nodes.Add(card.Text);

            // the ID is handled buy the mean of the node's Tag
            addedNode.Tag = card.Id;
        }
Exemple #7
0
 public Card Move_card_to_column(Card card, int destinationColumnIndex)
 {
     this.ts.TraceInformation("Move card {0} from {1} to {2}", card.Id, card.ColumnIndex, destinationColumnIndex);
     card.ColumnIndex = destinationColumnIndex;
     return card;
 }