Example #1
0
        public async Task Business_AddTask_No_Valid_Description_Empty()
        {
            var respositoryMock = new Mock <IReposotoryTask>();

            var task = new TaskModel {
                Description = string.Empty
            };

            respositoryMock.Setup(busi => busi.AddTaskAsync(It.IsAny <TaskModel>())).ReturnsAsync(task);

            var business = new BusinessManager(respositoryMock.Object);

            var result = await business.AddTask(task);

            Assert.IsFalse(result.Success);
            Assert.IsTrue(result.MessageError == "Task description cannot be empty");
        }
Example #2
0
        public async Task Business_DeleteTask_Success()
        {
            var respositoryMock = new Mock <IReposotoryTask>();

            var task = new TaskModel {
                Id = 1, Description = "First task"
            };

            respositoryMock.Setup(busi => busi.DeleteTaskAsync(It.IsAny <TaskModel>())).ReturnsAsync(task);

            var business = new BusinessManager(respositoryMock.Object);

            var result = await business.AddTask(task);

            Assert.IsTrue(result.Success);
            Assert.IsTrue(result.MessageError == null);
        }