public async Task CanHArdDeleteQuestion() { // Arrange: var toDelete = await _sut.Get().FirstOrDefaultAsync(); int affected = toDelete.Answers.Count(); // Act: var result = await _sut.DeleteHardAsync(toDelete.Id); // Assert: var deleted = await _sut.Get().FirstOrDefaultAsync(x => x.Id == toDelete.Id); Assert.Null(deleted); Assert.Equal(1 + affected, result); }
public async Task CanHArdDeleteAnswer() { // Arrange: var toDelete = await _sut.Get().FirstOrDefaultAsync(); // Act: var result = await _sut.DeleteHardAsync(toDelete.Id); // Assert: var deleted = await _sut.Get().FirstOrDefaultAsync(x => x.Id == toDelete.Id); Assert.Null(deleted); Assert.Equal(1, result); }
public async Task <int> DeleteHardAsync(int id) { return(await _dal.DeleteHardAsync(id)); }