public List <ClaimToThing> Create(Dictionary <string, string> inputToBeParsed) { var claimsToThings = new List <ClaimToThing>(); foreach (var input in inputToBeParsed) { var claimToThing = _claimToThingConfigParser.Extract(input.Key, input.Value); if (claimToThing.IsError) { _logger.LogDebug($"Unable to extract configuration for key: {input.Key} and value: {input.Value} your configuration file is incorrect"); } else { claimsToThings.Add(claimToThing.Data); } } return(claimsToThings); }
private List <ClaimToThing> BuildAddThingsToRequest(Dictionary <string, string> thingBeingAdded) { var claimsToTHings = new List <ClaimToThing>(); foreach (var add in thingBeingAdded) { var claimToHeader = _claimToThingConfigurationParser.Extract(add.Key, add.Value); if (claimToHeader.IsError) { _logger.LogCritical(new EventId(1, "Application Failed to start"), $"Unable to extract configuration for key: {add.Key} and value: {add.Value} your configuration file is incorrect"); throw new Exception(claimToHeader.Errors[0].Message); } claimsToTHings.Add(claimToHeader.Data); } return(claimsToTHings); }
private void WhenICallTheExtractor() { var first = _dictionary.First(); _result = _claimToThingConfigurationParser.Extract(first.Key, first.Value); }