public async Task GetWorkItemsReturnWorkItemForInValidInputId() { var option = new DbContextOptionsBuilder <WorkItemDbContext>().UseInMemoryDatabase(nameof(GetWorkItemsReturnAllWorkItem)).Options; var DbContext = new WorkItemDbContext(option); //CreateNewWorkItems(DbContext); var WorkitemProfile = new WorkItemProfile(); var config = new MapperConfiguration(cnf => cnf.AddProfile(WorkitemProfile)); var mapper = new Mapper(config); WorkItemProvider workItemProvider = new WorkItemProvider(DbContext, null, mapper); var workItem = await workItemProvider.GetWorkItemAsync(20); Assert.True(!workItem.IsSuccess); Assert.Null(workItem.workItem); Assert.NotNull(workItem.ErrorMessage); }
public async Task GetWorkItemsReturnAllWorkItem() { var option = new DbContextOptionsBuilder <WorkItemDbContext>().UseInMemoryDatabase(nameof(GetWorkItemsReturnAllWorkItem)).Options; var DbContext = new WorkItemDbContext(option); CreateNewWorkItems(DbContext); var WorkitemProfile = new WorkItemProfile(); var config = new MapperConfiguration(cnf => cnf.AddProfile(WorkitemProfile)); var mapper = new Mapper(config); WorkItemProvider workItemProvider = new WorkItemProvider(DbContext, null, mapper); var workItem = await workItemProvider.GetWorkItemsAsync(); Assert.True(workItem.IsSuccess); Assert.True(workItem.workItems.Any()); Assert.Equal(12, workItem.workItems.Count()); }