// TODO add data for other properties that need populating // Fill in the values for expected results .... public void Returns_Expected_Data(string key, string propertyName, object expectedValue, Guid organizationId, Guid userId, Guid providerDefinitionId) // TODO add additional parameters to populate CrawlJobData instance { var property = _jobData.GetType().GetProperty(propertyName); property?.SetValue(_jobData, expectedValue); var result = Sut.GetHelperConfiguration(null, _jobData, organizationId, userId, providerDefinitionId) .Result; result .ContainsKey(key) .ShouldBeTrue( $"{key} not found in results"); result[key] .ShouldBe(expectedValue); }
public override async Task <IDictionary <string, object> > GetHelperConfiguration(ProviderUpdateContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) { if (jobData is GleifExternalSearchJobData result) { return(await Task.FromResult(result.ToDictionary())); } throw new InvalidOperationException($"Unexpected data type for {nameof(GleifExternalSearchJobData)}, {jobData.GetType()}"); }
public override async Task <IDictionary <string, object> > GetHelperConfiguration( ProviderUpdateContext context, [NotNull] CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) { if (jobData == null) { throw new ArgumentNullException(nameof(jobData)); } if (jobData is HubSpotCrawlJobData hubspotCrawlJobData) { if (_notifications != null) { _notifications.Publish <ProviderMessageCommand>(new ProviderMessageCommand() { OrganizationId = organizationId, ProviderDefinitionId = providerDefinitionId, ProviderId = this.Id, ProviderName = this.Name, Message = "Authenticating", UserId = userId }); } var result = hubspotCrawlJobData.ToDictionary(); result.Add("webhooks", new List <object>() { new { DisplayName = "New Contact", Name = "contact.creation", Status = "ACTIVE", Description = "When a new contact is created." }, new { DisplayName = "Deleted Contact", Name = "contact.deletion", Status = "ACTIVE", Description = "When a contact is deleted." }, new { DisplayName = "Contact Update", Name = "contact.propertyChange", Status = "ACTIVE", Description = "When a contact is updated." }, new { DisplayName = "New Company", Name = "company.creation", Status = "ACTIVE", Description = "When a company is created." }, new { DisplayName = "Deleted Company", Name = "company.deletion", Status = "ACTIVE", Description = "When a company is deleted." }, new { DisplayName = "Company Update", Name = "company.propertyChange", Status = "ACTIVE", Description = "When a company is updated." }, new { DisplayName = "New Deal", Name = "deal.creation", Status = "ACTIVE", Description = "When a deal is created." }, new { DisplayName = "Deleted Deal", Name = "deal.deletion", Status = "ACTIVE", Description = "When a deal is deleted" }, new { DisplayName = "Deal Update", Name = "deal.propertyChange", Status = "ACTIVE", Description = "When a deal is updated." } }); result.Add("expectedStatistics", hubspotCrawlJobData.ExpectedStatistics); return(await Task.FromResult(result)); } throw new InvalidOperationException($"Unpexected data type for HubSpotJobCrawlData, {jobData.GetType()}"); }
public override Task <IDictionary <string, object> > GetHelperConfiguration( ProviderUpdateContext context, [NotNull] CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) { if (jobData == null) { throw new ArgumentNullException(nameof(jobData)); } if (jobData is SnowflakeConnectorJobData result) { return(Task.FromResult(result.ToDictionary())); } throw new InvalidOperationException($"Unexpected data type for SnowflakeConnectorJobData, {jobData.GetType()}"); }