示例#1
0
        public void Delete_PostIt_DoesLookupThroughRepository()
        {
            var boardRepo = new Mock <IBoardRepository>();

            var board = new Board()
            {
                Id = 1, Name = "Sample"
            };

            boardRepo.Setup(x => x.Find(It.IsAny <int>())).Returns(new Board());
            boardRepo.Setup(x => x.FindPostIt(It.IsAny <Board>(), It.Is <int>(i => i == 1))).Returns(
                new PostIt()
            {
                Id = 1, Text = "Sample"
            }
                );

            var controller = new BoardsController(boardRepo.Object);

            controller.DeletePostIt(1, 1);


            boardRepo.Verify(x => x.FindPostIt(board, 1), Times.Never);
        }