コード例 #1
0
 public void SetUp()
 {
     _mockBlobDeleteService = new Mock <IEventGridImageBlobDeleteService>();
     _mockValidationService = new Mock <IEventGridValidationService>();
     _logger  = new Mock <ILogger>().Object;
     _handler = new BlobDeleteWebhookHandler(_mockValidationService.Object, _mockBlobDeleteService.Object);
 }
コード例 #2
0
        public BlobDeleteWebhook()
        {
            string accessToken = System.Environment.GetEnvironmentVariable("ACCESS_TOKEN");

            string       keyVaultName     = System.Environment.GetEnvironmentVariable("KEY_VAULT_NAME");
            string       keyVaultUri      = $"https://{keyVaultName}.vault.azure.net";
            SecretClient keyVaultClient   = new SecretClient(new Uri(keyVaultUri), new DefaultAzureCredential());
            string       connectionString = keyVaultClient.GetSecret("DATABASE-CONNECTION-STRING").Value.Value;

            IEventGridValidationService      eventGridValidationService      = new EventGridValidationService();
            IEventGridImageBlobDeleteService eventGridImageBlobDeleteService = new EventGridImageBlobDeleteService(
                new EFImagePostService(new ShowNTellDbContextFactory(
                                           new DbContextOptionsBuilder().UseSqlServer(connectionString).Options)), accessToken);

            _handler = new BlobDeleteWebhookHandler(eventGridValidationService, eventGridImageBlobDeleteService);
        }