public async void AddVoteCanReturnNotFoundIfErrorNotFoundForGivenIDInDatabase() { DbContextOptions <BrokenAPIContext> options = new DbContextOptionsBuilder <BrokenAPIContext>() .UseInMemoryDatabase("addVoteIncorrectID") .Options; using (BrokenAPIContext context = new BrokenAPIContext(options)) { // Arrange ErrorController ec = new ErrorController(context); Error newError = new Error { ErrorCategoryID = 0, DetailedName = "Test", Description = "This is a testError.", Link = "test", CodeExample = "test", IsUserExample = false, Votes = 0, Rating = 0 }; await ec.PostError(newError); // Act var response = await ec.AddVote(100); // Assert Assert.Equal("Microsoft.AspNetCore.Mvc.NotFoundResult", response.ToString()); } }