Example #1
0
        public async void ListActiveAsync_ReturnsActiveResources()
        {
            //Arrange
            var options = InMemoryUtils.ProduceFreshDbContextOptions();

            using (var context = new ApplicationDbContext(options))
            {
                context.Resources.Add(ResourceUtils.TestSet.First(r => r.IsActive == true));
                context.SaveChanges();
            }

            //Act
            using (var context = new ApplicationDbContext(options))
            {
                IActEntityRepository <Resource, int, ApplicationUser, string> repo = new ResourcesRepository(context);
                var result = await repo.ListActiveAsync();

                //Assert
                Assert.NotEmpty(result);
                Assert.IsAssignableFrom <IEnumerable <Resource> >(result);
            }
        }