public JobOffersControllerTests() { options = new DbContextOptionsBuilder <HRPotterContext>() .UseInMemoryDatabase(databaseName: "HRPotterDatabase").Options; context = new HRPotterContext(options); context.JobOffers.Add(jobOffers[0]); context.JobOffers.Add(jobOffers[1]); context.JobApplications.Add(jobApplications[3]); context.Companies.Add(companies[0]); context.Roles.Add(new Role { Id = 1, Name = "User" }); context.Roles.Add(new Role { Id = 2, Name = "HR" }); context.SaveChanges(); IHttpContextAccessor accessor = new HttpContextAccessor(); var claims = new List <Claim>() { new Claim("objectidentifier", "f7c900ea-977d-4a24-8223-8da5cc8ff9b2"), new Claim("givenname", "unitTestsUser"), }; var identity = new ClaimsIdentity(claims, "TestAuthType"); accessor.HttpContext = new DefaultHttpContext(); accessor.HttpContext.User = new ClaimsPrincipal(identity); controller = new JobOffersController(context); controller.ControllerContext.HttpContext = accessor.HttpContext; }
public JobApplicationsController(HRPotterContext context, BlobServiceClient blobService) { _context = context; blobContainerClient = blobService.GetBlobContainerClient("job-applications"); s3Client = new AmazonS3Client(Amazon.RegionEndpoint.USEast1); var storageService = Environment.GetEnvironmentVariable("StorageService"); if (storageService == "S3") { storageType = StorageType.S3; } else { // By default use BlobStorage storageType = StorageType.BlobStorage; } bucketName = Environment.GetEnvironmentVariable("BucketName"); }
public HomeController(HRPotterContext context) { _context = context; }
public JobOffersController(HRPotterContext context) { _context = context; }
public UsersController(HRPotterContext context) { _context = context; }
public CompaniesController(HRPotterContext context) { _context = context; }