public async Task TestPutTasksInListClearAsync()
        {
            //Arrange
            var dbContext  = new DbContextMock.DbContextMocker().GetContext();
            var controller = new TaskInListController(dbContext);

            //Act
            int listID   = 1;
            var response = await controller.PutTasksInList(listID, new List <TaskInListDTO>()) as ObjectResult;


            //Assert
            Assert.Empty(dbContext.TasksInLists.Where((x) => x.ListID == listID));
            dbContext.Dispose();
        }
Esempio n. 2
0
        public void ListPropertyTestListInTask()
        {
            //Arrange
            var db = new DbContextMock.DbContextMocker().GetContext();

            //Act
            var lists = db.TaskLists;

            //Assert
            foreach (var l in lists)
            {
                Assert.NotNull(l.TasksInLists);
                //Assert.NotNull(t);
            }
            db.Dispose();
        }
Esempio n. 3
0
        public void TaskPropertyTestInTIL()
        {
            //Arrange
            var db = new DbContextMock.DbContextMocker().GetContext();

            //Act
            var tils = db.TasksInLists;

            //Assert
            foreach (var til in tils)
            {
                Assert.NotNull(til.Task);
                Assert.NotNull(til.List);
            }
            db.Dispose();
        }
Esempio n. 4
0
        public void TaskPropertyTestListInTask()
        {
            //Arrange
            var db = new DbContextMock.DbContextMocker().GetContext();

            //Act
            var tasks = db.TaskItems;

            //Assert
            foreach (var t in tasks)
            {
                var tils = db.TasksInLists.Where((x) => x.TaskID == t.ID).Count();
                //if (tils == 0)
                //    Assert.Null(t.TasksInLists);
                //else
                Assert.Equal(tils, t.TasksInLists.Count);
                //Assert.NotNull(t);
            }
            db.Dispose();
        }
        public async Task TestPutTasksInList_CleanAndPutAdd1Async()
        {
            //Arrange
            var dbContext  = new DbContextMock.DbContextMocker().GetContext();
            var controller = new TaskInListController(dbContext);

            //Act
            int listID   = 1;
            var response = await controller.PutTasksInList(listID, new List <TaskInListDTO>() {
                new TaskInListDTO()
                {
                    OrderNo  = 1,
                    TaskID   = null,
                    TaskName = "test add task"
                }
            }) as ObjectResult;


            //Assert
            Assert.Equal(1, dbContext.TasksInLists.Count((x) => x.ListID == listID));
            //Assert.Equal(task.ID, dbContext.TasksInLists.First((x) => x.ListID == listID).TaskID);
            dbContext.Dispose();
        }