public static void Consume(string instance) { var consumer = new Consumer(Config.HostName, Config.ConsumerName, instance, Format.Json); while (true) { string recv; try { recv = consumer.GetMessages(Config.TopicName); } catch (Exception e) { Log.Error(e.Message); continue; } try { var obj = JsonConvert.DeserializeObject<dynamic[]>(recv); foreach (var o in obj) Handle(o.value.ToObject<XTask>()); } catch (Exception e) { Log.Error($"Error deserializing messages: {recv}"); } } }
public void FillOptionsStore_AddAdmin_OptionsStoresHaveTwoStores() { var adminStore = new Store() { StoreName = "Admin" }; _context.Stores.Add(adminStore); _context.SaveChanges(); var consumer = new Consumer.Consumer(_unit); Assert.That(consumer.OptionsStores.Count, Is.EqualTo(2)); }
public void FillOptionsStore_AddStore_OptionsStoresHaveThreeStores() { var NewStore = new Store() { StoreName = "NewStore" }; _context.Stores.Add(NewStore); _context.SaveChanges(); var consumer = new Consumer.Consumer(_unit); Assert.That(consumer.OptionsStores.Count, Is.EqualTo(3)); }
public void Consumer_CheckingOptionStores_OpstionStoreCountIs1() { _unitWork.Stores.GetAllStores().Returns(new List<Store>() {new Store() {StoreName = "Fakta"} }); var consumer = new Consumer.Consumer(_unitWork); Assert.That(consumer.OptionsStores.Count, Is.EqualTo(1)); }
public void SetUp() { _unitWork = Substitute.For<IUnitOfWork>(); _store = new Store() {StoreName = "Aldi", StoreId = 22}; _product = new Product() {ProductName = "Banan", ProductId = 10}; _unitWork.Stores.GetAllStores().Returns(new List<Store>()); _uut = new Consumer.Consumer(_unitWork); }
public GeneratedShoppingListModel(Consumer.Consumer user) { _user = user; }
public FindProductModel(Consumer.IConsumer user) { User = user; }
static void Main(string[] args) { _consumer = new Consumer(RabbitMQProvider.RabbitMQService.QUEUE_NAME); Console.ReadKey(); }