Пример #1
0
        public async Task TestGetItemById()
        {
            //Act
            todoRepository.Setup(a => a.GetAllEnumerable()).Returns(todoItems.AsEnumerable <TodoItem>());

            //Arrange
            var todoBL   = new TodoBL(todoRepository.Object);
            var todoItem = await todoBL.Find(1);

            //Assert
            Assert.AreEqual(todoItem.Id, 1);
            Assert.AreEqual(todoItem.Name, "todo1");
        }
Пример #2
0
        public async Task UpdateTodoItem()
        {
            //Act
            todoRepository.Setup(a => a.GetAllEnumerable()).Returns(todoItems.AsEnumerable <TodoItem>());
            //Arrange
            var         todoBL = new TodoBL(todoRepository.Object);
            TodoItemDTO item   = new TodoItemDTO {
                Id = 2, Name = "todo22", IsComplete = true
            };
            await todoBL.Update(2, item);

            TodoItem todoItem = todoItems.Where(a => a.Id == 2).First();
            TodoItem temp     = await todoBL.Find(2);

            //Assert
            Assert.AreEqual(temp.Name, "todo22");
        }