예제 #1
0
파일: Mapper.cs 프로젝트: rpgrca/netcore
        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));
        }
예제 #2
0
        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()));
        }
예제 #3
0
파일: Mapper.cs 프로젝트: rpgrca/netcore
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
 /// <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);
 }
예제 #6
0
파일: Mapper.cs 프로젝트: rpgrca/netcore
        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));
        }
예제 #7
0
 /// <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();
 }
예제 #8
0
        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()));
        }
예제 #9
0
 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);
 }
예제 #10
0
        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];
        }
예제 #12
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);
 }
예제 #14
0
 public MainWindow()
 {
     InitializeComponent();
     User = new Consumer.Consumer();
 }
예제 #15
0
 public void SetUp()
 {
     _uut = new Consumer.Consumer();
 }