public async Task Delete_EntryRemoved_ReturnsOk() { _service.Setup(s => s.Delete(It.IsAny <long>(), It.IsAny <long>())); _controller = new EntriesController(_logger, _service.Object); var result = await _controller.Delete(1L, 1L); result.Should().BeOfType <OkResult>(); }
public void DeleteEntryWorks() { DateTime dt1 = new DateTime(2020, 1, 16); _userService.SetUser(_regularUser1); _context.Add(new Entry() { Id = 1, Date = dt1, UserId = _regularUser1.Id }); _context.Add(new Entry() { Id = 2, Date = dt1, UserId = _regularUser1.Id }); _context.SaveChanges(); _controller.Delete(1); var res = ((_controller.Get(dt1, dt1, null) as OkObjectResult).Value as IEnumerable <EntryDTO>).ToArray(); Assert.AreEqual(2, res.Single().Id); }