public FakeZendesk() { var conf = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true) .AddJsonFile("appsettings.local.json", optional: true) .AddUserSecrets("ZendeskMonitorSecrets") .Build(); var instance = conf.GetValue <string>("Zendesk:Instance"); var user = conf.GetValue <string>("Zendesk:ApiUser"); var token = conf.GetValue <string>("Zendesk:ApiKey"); var useLiveZendesk = conf.GetValue <bool?>("Zendesk:UseLiveInstance") ?? false; server = FluentMockServer.Start(new FluentMockServerSettings { ReadStaticMappings = !useLiveZendesk, FileSystemHandler = new LocalFileSystemHandler(ProjectPath), ProxyAndRecordSettings = useLiveZendesk ? LiveZendeskProxySettings(instance) : null, }); var url = server.Urls.First(); var httpClient = new HttpClient { BaseAddress = new Uri($"https://{instance}.zendesk.com/api/v2") }; httpClient.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue { NoCache = true }; var byteArray = Encoding.ASCII.GetBytes($"{user}:{token}"); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); zendeskApi = ApiFactory.CreateApi(httpClient); sharing = new SharingTickets(zendeskApi); ticketFieldIds = new Lazy <Task <Dictionary <string, long> > >(LoadTicketFields); }