GetSurveysByOwnerAsync() public method

public GetSurveysByOwnerAsync ( int userId, int pageIndex, int pageSize = Constants.DefaultPageSize ) : Task>
userId int
pageIndex int
pageSize int
return Task>
        public async Task GetSurveysByOwnerAsync_Returns_CorrectSurveys()
        {
            // All contexts that share the same service provider will share the same InMemory database
            var options = CreateNewContextOptions();

            // Run the test against one instance of the context
            using (var context = new ApplicationDbContext(options))
            {
                context.AddRange(
                    new Survey { Id = 1, OwnerId = 1 },
                    new Survey { Id = 2, OwnerId = 1 },
                    new Survey { Id = 3, OwnerId = 2 }
                    );
                context.SaveChanges();
            }

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new ApplicationDbContext(options))
            {
                var store = new SqlServerSurveyStore(context);
                var result = await store.GetSurveysByOwnerAsync(1);

                Assert.NotEmpty(result);
                // Returned collection should only contain surveys with the matching owner ID.
                Assert.True(result.All(s => s.OwnerId == 1));
            }
        }