/// <inheritdoc/> public void DeleteWorkItem(int ID) { WorkItemLogic workItemLogic = new WorkItemLogic(mDBContext); workItemLogic.DeleteWorkItem(ID); mDBContext.SaveChanges(); }
public void DeleteWorkItem_OnValidRequest_DeletesEntry() { // ARRANGE DbContextOptions <TestDatabaseContext> options = new DbContextOptionsBuilder <TestDatabaseContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; IDatabaseContext context = new TestDatabaseContext(options); WorkItemLogic logic = new WorkItemLogic(context); WorkItem request = new WorkItem() { ID = 1, }; context.WorkItems.Add(request); context.SaveChanges(); // ACT logic.DeleteWorkItem(1); context.SaveChanges(); // ASSERT context.WorkItems.Any(wi => wi.ID == 1).Should().BeFalse(); }