public async Task DeleteUrlAsync_WhenExists_DeletesUrl() { var expected = (await FeedTestData(_context, 10)).First(); var service = new UrlService(_context); var actual = await service.DeleteUrlAsync(expected); Assert.Equal((expected.AdverbId, expected.AdjectiveId, expected.NounId), actual); }
public async Task DeleteUrlAsync_WhenDoesNotExist_IsNoop() { const int expectedCount = 5; await FeedTestData(_context, expectedCount); var nonExistent = GenerateUrl(); nonExistent.AdverbId = 101; nonExistent.AdjectiveId = 101; nonExistent.NounId = 101; var service = new UrlService(_context); var actual = await service.DeleteUrlAsync(nonExistent); Assert.Equal(expectedCount, _context.Urls.Count()); Assert.Equal((-1, -1, -1), actual); }