コード例 #1
0
        public void AddBoard()
        {
            // Arrange
            var stubBoards = new InMemoryDbSet<Board>();
            var board = new Board() { Model = new BoardModel { Name = "Dummy" }, Volume = 1 };
            stubEntities.Boards = stubBoards;

            // Act
            var sut = new EquipmentRepository(stubEntities, stubLogger);
            sut.AddBoard(board);

            // Assert
            Assert.AreEqual(1, stubBoards.Count(), "Boards count incorrect");
        }
コード例 #2
0
        public void AddBoard()
        {
            // Arrange
            int expected = _context.Boards.Count() + 1;
            var board = new Board() { Model = new BoardModel() { Manufacturer = _context.Manufacturers.Single(m => m.Name == "JP"), Name = "Dummy" }, Volume = 74 };
            var sut = new EquipmentRepository(_context, _stubLogger);

            // Act
            sut.AddBoard(board);
            _context.Save();

            // Assert
            Assert.AreEqual(expected, _context.Boards.Count(), "Boards count incorrect");
        }
コード例 #3
0
 public Board AddBoard(Board board)
 {
     return Add(_context.Boards, board, b => String.Compare(b.Model.Name, board.Model.Name, true) == 0 && b.Volume == board.Volume);
 }