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");
        }
Exemplo n.º 3
0
 public HomeController(HRPotterContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
 public JobOffersController(HRPotterContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public UsersController(HRPotterContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public CompaniesController(HRPotterContext context)
 {
     _context = context;
 }