public void DoesFindByIdWorks() { var options = new DbContextOptionsBuilder <MDManagementDbContext>() .UseInMemoryDatabase(databaseName: "testDb") .Options; using (var dbContext = new MDManagementDbContext(options)) { ICompanyDataService service = new CompanyDataSerive(dbContext); CreateCompanyServiceModel serviceModel = new CreateCompanyServiceModel { Name = "MDM", Description = "No" }; service.Create(serviceModel); var result = service.FindById(1).Name; Assert.AreEqual("MDM", 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); } }