示例#1
0
        public void Setup()
        {
            //Create an InMemory Sqlite Database for testing
            var connection = new InMemorySqliteConnection();

            //Seed method is called automatically
            _context = connection._context;
        }
        public void Setup()
        {
            //Create an InMemory Sqlite Database for testing
            var connection = new InMemorySqliteConnection();

            _context = connection._context;

            //Create the repository class that will be tested
            _repositorySchool       = new SchoolPerformanceRepository <School>(_context);
            _repositorySchoolResult = new SchoolPerformanceRepository <SchoolResult>(_context);

            //Mock data
            SetData();

            //Remove existing seeded data
            ClearSeedData();

            //Add and save the mock data to the context
            _schools.ForEach(x => _context.School.Add(x));
            _schoolResults.ForEach(x => _context.SchoolResult.Add(x));
            _context.SaveChanges();
        }