示例#1
0
        public void Search_ContextHasRecords()
        {
            //Arrange
            var employees = EmployeeSeed.Data();

            //Act
            var results = _manager.Add(employees);

            //Assert
            Assert.True(results.Succeeded);
        }
示例#2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new EmplyeeDbConext(
                       serviceProvider.GetRequiredService <DbContextOptions <EmplyeeDbConext> >()))
            {
                // Look for any board games.
                if (context.Employee.Any())
                {
                    return;   // Data was already seeded
                }

                var employees = EmployeeSeed.Data();
                context.Employee.AddRange(employees);

                context.SaveChanges();
            }
        }
示例#3
0
        public void Search_FindStaffs()
        {
            //Arrange
            var employees = EmployeeSeed.Data();
            var search    = "Baxter";

            //Act
            var addResults = _manager.Add(employees);
            var results    = _manager.Find(search);


            //Assert
            Assert.True(addResults.Succeeded);

            Assert.True(results.Succeeded);
            Assert.Equal(search, results.Employees.First().Lastname);
        }