Example #1
0
        public void DoesCreateJobTitleWorks()
        {
            var options = new DbContextOptionsBuilder <MDManagementDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            using (var dbContext = new MDManagementDbContext(options))
            {
                IJobTitleDataService service = new JobTittleDataServie(dbContext);

                service.CreateJobTitile("CEO");

                Assert.AreEqual("CEO", dbContext.JobTitles.FirstOrDefault().Name);
            }
        }
Example #2
0
        public void DoesFindByIdWorks()
        {
            var options = new DbContextOptionsBuilder <MDManagementDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            using (var dbContext = new MDManagementDbContext(options))
            {
                IJobTitleDataService service = new JobTittleDataServie(dbContext);

                service.CreateJobTitile("CEO");

                var result = service.FindById(1).Name;

                Assert.AreEqual("CEO", result);
            }
        }
Example #3
0
        public void DoesExistsByNameWorks()
        {
            var options = new DbContextOptionsBuilder <MDManagementDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            using (var dbContext = new MDManagementDbContext(options))
            {
                IJobTitleDataService service = new JobTittleDataServie(dbContext);

                service.CreateJobTitile("CEO");

                var result = service.Exists("CEO");

                Assert.IsTrue(result);
            }
        }
        public void DoesCreateWorks()
        {
            var options = new DbContextOptionsBuilder <MDManagementDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            using (var dbContext = new MDManagementDbContext(options))
            {
                var userManager = new Mock <UserManager <Employee> >().Object;
                IJobTitleDataService jobTitleService = new JobTittleDataServie(dbContext);
                ICompanyDataService  companyService  = new CompanyDataSerive(dbContext);
                IEmployeeDataService employeeService = new EmployeeDataService(dbContext, jobTitleService, companyService, userManager);
                IProjectDataService  projectService  = new ProjectDataService(dbContext, employeeService);

                var modelService = new ProjectServiceModel
                {
                    Name        = "AI",
                    Description = "nope",
                };

                Assert.AreEqual("AI", dbContext.Projects.FirstOrDefault().Name);
            }
        }