예제 #1
0
        public async void DoesNotProposeDoneTasks()
        {
            var options = new DbContextOptionsBuilder <DatabaseContext>().UseInMemoryDatabase(databaseName: "PlanningTest2").Options;

            using (var context = new DatabaseContext(options))
            {
                string userId = "fbid";
                context.Users.Add(new User()
                {
                    FacebookId = userId
                });
                context.ListCategories.Add(new ListCategory()
                {
                    Id = 1, Category = "bb", OwnerId = userId
                });
                context.Tasks.Add(new Time_planner_api.Models.Task()
                {
                    Id = 1, Title = "aa", CategoryId = 1, IsDone = true
                });
                context.SaveChanges();
                var controller = new PlanningController(context);
                AddUserClaim(controller, userId);
                var result = await controller.FindTasksForToday();

                Assert.Empty(result.Value);
            }
        }
예제 #2
0
        public async void DoesNotProposeFullyAssignedTasks()
        {
            var options = new DbContextOptionsBuilder <DatabaseContext>().UseInMemoryDatabase(databaseName: "PlanningTest3").Options;

            using (var context = new DatabaseContext(options))
            {
                string userId = "fbid";
                context.Users.Add(new User()
                {
                    FacebookId = userId
                });
                context.ListCategories.Add(new ListCategory()
                {
                    Id = 1, Category = "bb", OwnerId = userId
                });
                context.Tasks.Add(new Time_planner_api.Models.Task()
                {
                    Id         = 1,
                    Title      = "aa",
                    CategoryId = 1,
                    Date0      = DateTime.Now,
                    Date1      = DateTime.Now.AddDays(-3),
                    Date2      = DateTime.Now.AddDays(5),
                    Date3      = DateTime.Now.AddDays(8),
                    Date4      = DateTime.Now.AddMonths(1),
                    Date5      = DateTime.Now.AddYears(-3),
                    Date6      = DateTime.Now.AddMinutes(919)
                });
                context.SaveChanges();
                var controller = new PlanningController(context);
                AddUserClaim(controller, userId);
                var result = await controller.FindTasksForToday();

                Assert.Empty(result.Value);
            }
        }