public void KnownLeiReturnsInternalId()
 {
     var lei = "549300O5MFEP1XJ40B46";
     var enricher = new PartyEnricher();
     var internalId = enricher.GetInternalId(lei);
     Assert.AreEqual("5678", internalId);
 }
        public void Handle(IMessage message)
        {
            var stopwatch = Stopwatch.StartNew();
            var tradeMessage = message as ValidateTradeMessage;

            Console.WriteLine("| EnrichPartyHandler | Received trade with message ID: " + tradeMessage.TradeId);

            using (var db = _dbFactory.GetContext())
            {
                var trade = db.IncomingTrades.Find(tradeMessage.TradeId);

                var enricher = new PartyEnricher();
                if (_enrichParty1)
                {
                    trade.Party1Id = enricher.GetInternalId(trade.Party1Lei);
                }
                if (_enrichParty2)
                {
                    trade.Party2Id = enricher.GetInternalId(trade.Party2Lei);
                }

                trade.ProcessedAt = DateTime.UtcNow;
                db.SaveChanges();
            }

            Console.WriteLine("* | EnrichPartyHandler | Processed trade with ID: {0}, took: {1}ms", tradeMessage.TradeId, stopwatch.ElapsedMilliseconds);
        }
 public void UnknownLeiThrowsException()
 {
     var lei = "xyz";
     var enricher = new PartyEnricher();
     enricher.GetInternalId(lei);
 }