public void TestDelete() { Resource resource = new Resource(); resource.Description = "Test"; resource.Link = "some link"; resource.Title = "Test Resource"; resource.ProviderName = "Unit Test"; Assert.True(ResourceDBConnector.Create(dataSource, resource)); List <Resource> resources = ResourceDBConnector.GetResources(dataSource, "SELECT * FROM Resource"); Assert.NotNull(resources); int count = resources.Count; Assert.True(ResourceDBConnector.Delete(dataSource, (int)resources[0].Id)); resources = ResourceDBConnector.GetResources(dataSource, "SELECT * FROM Resource"); Assert.NotNull(resources); Assert.Equal(count - 1, resources.Count); }
public IActionResult Delete(int id) { ResourceDBConnector.Delete(Constants.DATA_SOURCE, id); return(Redirect("/Resources")); }