public void Initialize() { _logger.LogDebug(nameof(Initialize)); var defSettings = new FhirClientSettings { UseFormatParameter = true, PreferredFormat = ResourceFormat.Json, PreferredReturn = Prefer.ReturnRepresentation, Timeout = 10000 // 10 seconds }; Endpoint = _fhirOptions.Endpoint; if (string.IsNullOrWhiteSpace(_fhirOptions.BearerToken)) { Client = new FhirClient(Endpoint, defSettings); } else { var messageHandler = new AuthenticationMessageHandler { Authorization = new AuthenticationHeaderValue("Bearer", _fhirOptions.BearerToken) }; Client = new FhirClient(Endpoint, defSettings, messageHandler); } }
public async Task GetcustomerAddressesTest() { var config = PowerAppsConfigurationReader.GetConfiguration(); using (var tokenProvider = new AuthenticationMessageHandler(config)) using (var repo = serviceProvider.GetService <GenericRepository <Account> >()) { var addresses = await repo.GetList(); } }
public async Task CreateAccountTest() { var config = PowerAppsConfigurationReader.GetConfiguration(); using (var tokenProvider = new AuthenticationMessageHandler(config)) using (var repo = serviceProvider.GetService <GenericRepository <Account> >()) { repo.MSCRMCallerID = Guid.Parse("BFC5064F-C69E-42B4-884D-83E3A9900945"); var account = new Account { Name = Guid.NewGuid().ToString(), AccountCategoryCode = account_accountcategorycode.Standard, AccountClassificationCode = account_accountclassificationcode.DefaultValue, AccountRatingCode = account_accountratingcode.DefaultValue, AccountNumber = "11111111", Address1_AddressTypeCode = account_address1_addresstypecode.Primary, Address1_City = "Montreal", Address1_Country = "Canada", Address1_PostalCode = "H1H 1H1", Address1_StateOrProvince = "QC", DoNotEMail = true, DoNotPhone = false, CreditLimit = 500000.99m, EMailAddress1 = string.Empty, Telephone1 = "Telephone1", Fax = "Fax", WebSiteURL = "WebSiteURL", LastOnHoldTime = new DateTime(2019, 1, 1, 0, 0, 0) }; var accountid = await repo.Create(account); Assert.NotEqual(Guid.Empty, accountid); account = await repo.GetById( accountid, p => new { Id = p.Id, StateCode = p.StateCode, StatusCode = p.StatusCode, LastOnHoldTime = p.LastOnHoldTime, ModifiedOn = p.ModifiedOn, CreatedOn = p.CreatedOn, CreatedBy = p.CreatedBy, OwnerId = p.OwnerId, ParentAccountId = p.ParentAccountId, Telephone1 = p.Telephone1, }); var owner = account.OwnerId; } }
public async Task GetMultipleTest() { var config = PowerAppsConfigurationReader.GetConfiguration(); using (var tokenProvider = new AuthenticationMessageHandler(config)) using (var repo = serviceProvider.GetService <GenericRepository <Account> >()) { var accounts = await repo.GetList(); Assert.NotNull(accounts); } }