Exemple #1
0
        public void SetUp()
        {
            var builder = new WebHostBuilder()
                          .UseStartup <Startup>();
            var testServer = new TestServer(builder);
            var httpClient = testServer.CreateClient();

            _sut = new BasketClient(httpClient);
        }
Exemple #2
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent(IBasketClient client)
 {
     this.client = client;
     client.GetItems();
     this.components    = new System.ComponentModel.Container();
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize    = new System.Drawing.Size(800, 450);
     this.Text          = "Form1";
     this.Load         += new EventHandler(Form1_Load);
 }
Exemple #3
0
 public async Task OnGet([FromServices] IBasketClient client)
 {
     try
     {
         BasketContents = await client.GetBasketForCustomer(1);
     }
     catch (Exception)
     {
         BasketContents = "Basket Service Unavailable";
     }
 }
Exemple #4
0
        public ApiClient(HttpClient httpClient, IConfiguration configuration)
        {
            var apiConfigurations = new ApiConfigurations();

            new ConfigureFromConfigurationOptions <ApiConfigurations>(configuration.GetSection("ApiConfigurations"))
            .Configure(apiConfigurations);

            _apiEndpoint = apiConfigurations.BaseURL;

            if (!_apiEndpoint.EndsWith("/"))
            {
                _apiEndpoint += "/";
            }

            httpClient.DefaultRequestHeaders.Authorization
                = new AuthenticationHeaderValue("Bearer", apiConfigurations.Token);

            BasketClient       = new BasketClient(_apiEndpoint, httpClient);
            ProductGroupClient = new ProductGroupClient(_apiEndpoint, httpClient);
            ProductClient      = new ProductClient(_apiEndpoint, httpClient);
            LoginClient        = new LoginClient(_apiEndpoint, httpClient);
        }
 public BasketService(IBasketClient basketClient)
 {
     _basketClient = basketClient.httpClient;
 }
Exemple #6
0
 public ScanManager(IBasketClient client)
 {
     this.client = client;
 }
Exemple #7
0
 public OrdersController(IOrderClient orderClient, IBasketClient basketClient, IConfiguration config)
 {
     _orderClient  = orderClient;
     _basketClient = basketClient;
     _userName     = config["userName"] ?? "defaultUser";
 }
Exemple #8
0
 public void Setup()
 {
     mockBasketService = new Mock <IBasketService>();
     client            = new BasketClient(mockBasketService.Object);
 }
 public BasketController(ICatalogClient catalogClient, IBasketClient basketClient, IConfiguration config)
 {
     _catalogClient = catalogClient;
     _basketClient  = basketClient;
     _userName      = config["userName"] ?? "defaultUser";
 }
Exemple #10
0
 public Form1(IBasketClient client)
 {
     InitializeComponent(client);
 }