public async Task <Models.Adapter.UsersCollection> GetUsersAsync() { var request = new Consumer.Request("/users", Consumer.Method.Get); var consumer = new Consumer.Consumer(this.ServiceUrl); return(await consumer.ExecuteAsync <Models.Adapter.UsersCollection>(request)); }
public Models.Adapter.UsersCollection GetUsers() { var request = new Consumer.Request("/users", Consumer.Method.Get); var consumer = new Consumer.Consumer(this.ServiceUrl); return(consumer.Execute <Models.Adapter.UsersCollection, List <Models.Json.Users> >(request, new UsersCollectionAdapterFactory())); }
public Models.Adapter.UsersCollection GetUsers() { var request = new Consumer.Request("/users", Consumer.Method.Get); var consumer = new Consumer.Consumer(this.ServiceUrl); return(consumer.Execute <Models.Adapter.UsersCollection>(request)); }
public async Task <Models.Adapter.UsersCollection> GetUsersAsync() { var taskCompletionSource = new TaskCompletionSource <Models.Adapter.UsersCollection>(); var request = new Consumer.Request("/users", Consumer.Method.Get); var consumer = new Consumer.Consumer(this.ServiceUrl); return(await consumer.ExecuteAsync <Models.Adapter.UsersCollection, List <Models.Json.Users> >(request)); }
/// <summary> /// /// </summary> public MainWindow() { var unit = new UnitOfWork(new DataContext()); var user = new Consumer.Consumer(unit); var autocomplete = new Autocomplete(unit); var databaseFunctions = new DatabaseFunctions(unit); InitializeComponent(); DataContext = new ConsumerViewModel(user, autocomplete, databaseFunctions); }
public async Task <Models.Adapter.Users> GetUserAsync(int id) { var request = new Consumer.Request("/users/{id}", Consumer.Method.Get); request.AddParameter("id", id.ToString(), true); var consumer = new Consumer.Consumer(this.ServiceUrl); return(await consumer.ExecuteAsync <Models.Adapter.Users>(request)); }
/// <summary> /// Constructor /// </summary> public Subscriber(string connectTo, string subscribeTo, Consumer.Consumer <byte[]> consumer) { _zmqConnectTo = connectTo; _zmqSubscribeTopic = subscribeTo; // start the consumer _consumer = consumer; // start the ZMQ SUB worker _worker = new Thread(SubscribeWorker); _worker.Start(); }
public Models.Adapter.Users GetUser(int id) { var request = new Consumer.Request("/users/{id}", Consumer.Method.Get); request.AddParameter("id", id.ToString(), true); var consumer = new Consumer.Consumer(this.ServiceUrl); return(consumer.Execute <Models.Adapter.Users, Models.Json.Users>(request, new UsersAdapterFactory())); }
public void SetUp() { _unitWork = Substitute.For <IUnitOfWork>(); _store = new Store() { StoreName = "Aldi" }; _product = Substitute.For <Product>(); _product.ProductName = "Banan"; _product.HasARelation = new List <HasA>(); _uut = new Consumer.Consumer(_unitWork); }
public void TestCsvReader() { // Arrange Consumer.Consumer consumer = new Consumer.Consumer(); string user = "******"; string stock_code = "aapl.us"; // Act var result = consumer.ReadCSV($"{user},{stock_code}"); // Assert Assert.IsTrue(result); }
public ApplicationViewModel() { Consumer.Consumer user = new Consumer.Consumer(new UnitOfWork(new DataContext())); // Add available pages PageViewModels.Add(new HomeModel()); PageViewModels.Add(new FindProductModel(user)); PageViewModels.Add(new ShoppingListModel(user)); PageViewModels.Add(new GeneratedShoppingListModel(user)); if (!user.ConnectToDB()) //Force database to connect at startup, and close application if it cant connect { MessageBox.Show("Der kan ikke tilsluttes til serveren", "ERROR", MessageBoxButton.OK); Application.Current.MainWindow.Close(); } // Set starting page CurrentPageViewModel = PageViewModels[0]; }
static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "jobs_queue", durable: true, exclusive: false, autoDelete: true, arguments: null); channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false); Console.WriteLine(" [*] Waiting for messages."); var consumer = new EventingBasicConsumer(channel); consumer.Received += (sender, ea) => { var body = ea.Body.ToArray(); var message = Encoding.UTF8.GetString(body); Consumer.Consumer c = new Consumer.Consumer(); c.Consume(message); Console.WriteLine(" [x] Received {0}", message); int dots = message.Split('.').Length - 1; Thread.Sleep(dots * 1000); Console.WriteLine(" [x] Done"); channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); }; channel.BasicConsume(queue: "jobs_queue", autoAck: false, consumer: consumer); Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } }
public void SetUp() { _unitWork = Substitute.For<IUnitOfWork>(); _store = new Store() { StoreName = "Aldi" , StoreId = 22}; _product = new Product() {ProductName = "Banan", ProductId = 10}; _uut = new Consumer.Consumer(_unitWork); }
public MainWindow() { InitializeComponent(); User = new Consumer.Consumer(); }
public void SetUp() { _uut = new Consumer.Consumer(); }