public void TestInsert() { List <Resource> resources = ResourceDBConnector.GetResources(dataSource, "SELECT * FROM Resource"); Assert.NotNull(resources); int count = resources.Count; 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)); resources = ResourceDBConnector.GetResources(dataSource, "SELECT * FROM Resource"); Assert.NotNull(resources); Assert.Equal(count + 1, resources.Count); }
public IActionResult Add(Resource resource) { ResourceDBConnector.Create(Constants.DATA_SOURCE, resource); return(Redirect("/Resources")); }