public void GetCategoryWebSites_ReturnsWebSites() { // Arrange using (var context = new ApplicationDbContext(_options)) { context.Database.EnsureDeleted(); AddResourceTypes(context); AddCategories(context); context.Resources.AddRange( new Resource("test", "test", context.ResourceTypes.First(a => a.Id == 1), context.ResourceCategories.First(a => a.Id == 1)), new Resource("test2", "test2", context.ResourceTypes.First(a => a.Id == 1), context.ResourceCategories.First(a => a.Id == 1)), new Resource { Id = 3, Name = "test3", Description = "test2", ResourceType = context.ResourceTypes.First(a => a.Id == 1) }, new Resource { Id = 4, Name = "test4", Description = "test3", ResourceType = context.ResourceTypes.First(a => a.Id == 2) } ); context.SaveChanges(); var webSiteDataAccess = new ResourceDataAccess(context); // Act var webSites = webSiteDataAccess.GetCategoryWebSites(1); // Assert Assert.Equal(2, webSites.Count()); Assert.Equal("Programming / Development", webSites.First().ResourceCategory.Name); } }