public async Task Can_Not_Return_Task_When_Status_Is_Require_Modifications() { var userGroup = new UserGroup(); var user = new User { UserGroup = userGroup }; var dbContextOptions = CreateNewContextOptions(); using (var context = new ApplicationDbContext(dbContextOptions)) { context.Users.Add(user); context.DocumentTasks.Add(new DocumentTask { DocumentTaskStates = new List <DocumentTaskState> { new DocumentTaskState { DocumentTaskStatus = DocumentTaskStatus.RequireModifications, DocumentTaskTypePath = new DocumentTaskTypePath { UserGroup = userGroup } } } }); await context.SaveChangesAsync(); } using (var context = new ApplicationDbContext(dbContextOptions)) { var service = new DocumentTasksService(context); var tasks = await service.GetByUserId(user.Id); Assert.Equal(0, tasks.Count); } }
public async Task Can_Return_Finalized_Tasks() { var user = new User { UserGroup = new UserGroup() }; var dbContextOptions = CreateNewContextOptions(); using (var context = new ApplicationDbContext(dbContextOptions)) { context.Users.Add(user); context.DocumentTasks.Add(new DocumentTask { DocumentTaskStates = new List <DocumentTaskState> { new DocumentTaskState { DocumentTaskStatus = DocumentTaskStatus.Accepted } } }); await context.SaveChangesAsync(); } using (var context = new ApplicationDbContext(dbContextOptions)) { var service = new DocumentTasksService(context); var tasks = await service.GetByUserId(user.Id, true); Assert.Equal(1, tasks.Count); } }
public async Task Can_Return_User_Created_Task() { var user = new User(); var dbContextOptions = CreateNewContextOptions(); using (var context = new ApplicationDbContext(dbContextOptions)) { context.Users.Add(user); context.DocumentTasks.Add(new DocumentTask { User = user }); await context.SaveChangesAsync(); } using (var context = new ApplicationDbContext(dbContextOptions)) { var service = new DocumentTasksService(context); var tasks = await service.GetByUserId(user.Id); Assert.Equal(1, tasks.Count); } }