Exemple #1
0
        public void SetUp()
        {
            _dbcontext = new OrgChartDbContext();
            _jobTitle = new JobTitle
            {
                Description = "test",
            };

            _dbcontext.JobTitles.Add(_jobTitle);
            _dbcontext.SaveChanges();
        }
        public void SetUp()
        {
            _dbcontext = new OrgChartDbContext();
            _department = new Department
            {
                Name = "Test Department",
                ParentDepartmentId = null,
            };

            _dbcontext.Departments.Add(_department);
            _dbcontext.SaveChanges();
        }
Exemple #3
0
        public void SetUp()
        {
            _dbcontext = new OrgChartDbContext();
            _employee = new Employee
            {
                FirstName = "Test",
                LastName = "Person",
                JobTitleId = null,
                IsManager = false,
                ManagerId = null,
                DepartmentId = null,
            };

            _dbcontext.Employees.Add(_employee);
            _dbcontext.SaveChanges();
        }
        public void DbContext_WhenQueried_ShouldOnlyIncludeEntitiesForUser()
        {
            var personSet = _context.Set <Person>();

            personSet.Add(new Person {
                UserId = "00000000-0000-0000-0000-000000000000"
            });
            personSet.Add(new Person {
                UserId = "11111111-1111-1111-1111-111111111111"
            });
            _context.SaveChanges();

            var people = personSet.ToList();

            Assert.AreEqual(1, people.Count);
        }