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); } }
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); } }
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); } }