public void BrelloListEnsurePropertiesWork() { Card card1 = new Card { Title = "My Card" }; List<Card> list_of_cards = new List<Card>(); list_of_cards.Add(card1); BrelloList list = new BrelloList { Title = "My List", BrelloListId = 1, CreatedAt = DateTime.Parse("2015-01-02"), Cards = list_of_cards }; Assert.AreEqual("My List", list.Title); Assert.AreEqual(1, list.Cards.Count); }
public void BoardRepositoryEnsureFalseIfInvalidBoardId() { BoardRepository board_repo = new BoardRepository(mock_context.Object); BrelloList list = new BrelloList { Title = "ToDo", BrelloListId = 1 }; my_list.Add(new Board { Title = "My First Board", Owner = user1, BoardId = 1 }); ConnectMocksToDataSource(); bool actual = board_repo.AddList(3, list); Assert.AreEqual(0, board_repo.GetListCount()); Assert.IsFalse(actual); }
public void BoardEnsurePropertiesWork() { //Color color = new Color { Name = "Blue", Value = "#0000ff" }; // Object Initializer syntax Board board = new Board { Title = "My Board" }; BrelloList brello_list = new BrelloList { Title = "My List" }; board.Lists.Add(brello_list); ApplicationUser a_user = new ApplicationUser(); board.Followers.Add(a_user); Assert.AreEqual("My Board", board.Title); Assert.AreEqual(1, board.Lists.Count); Assert.AreEqual(1, board.Followers.Count); }
// void or bool or BrelloList public bool AddList(int _board_id, BrelloList _list) { var query = from b in context.Boards where b.BoardId == _board_id select b; Board found_board = null; bool result = true; try { found_board = query.Single<Board>(); found_board.Lists.Add(_list); context.SaveChanges(); } catch (InvalidOperationException) { result = false; } catch (ArgumentNullException) { result = false; } return result; }
// void or bool or BrelloList public bool AddList(int _board_id, BrelloList _list) { var query = from b in context.Boards where b.BoardId == _board_id select b; Board found_board = null; bool result = true; try { found_board = query.Single <Board>(); found_board.Lists.Add(_list); context.SaveChanges(); } catch (InvalidOperationException) { result = false; } catch (ArgumentNullException) { result = false; } return(result); }
public void BrelloListEnsureICanCreateInstance() { BrelloList brello_list = new BrelloList(); Assert.IsNotNull(brello_list); }