public void Delete_deletes_from_database()
        {
            var options = new DbContextOptionsBuilder <DatabaseContext>()
                          .UseInMemoryDatabase(databaseName: "Delete_deletes_from_database")
                          .Options;

            using (var context = new DatabaseContext(options))
            {
                var resource = new Resource
                {
                    Weight        = 10,
                    MaximumWeight = 15,
                    SchedulingId  = 10
                };

                var service = new ResourceService(context, new ResourceRepository(context));
                service.Add(resource);
                Assert.Single(context.Set <Resource>().ToList());

                var insertedResource = service.GetAll().First();

                service.Delete(insertedResource.Id);
                Assert.Empty(context.Set <Resource>().ToList());
            }
        }
예제 #2
0
        public void GetAll_WrongUserName_NoResults(string userName)
        {
            var links = ls.GetAll(userName);

            Assert.IsEmpty(links);
        }
 public IEnumerable <WResource> Get()
 {
     return(_resourceService.GetAll());
 }
예제 #4
0
 public List <Resource> GetAll()
 {
     return(_resourceService.GetAll());
 }
        public IQueryable <Resource> GetAll()
        {
            var list = _resourceService.GetAll();

            return(list.AsQueryable());
        }