public void SetUp() { var builder = new WebHostBuilder() .UseStartup <Startup>(); var testServer = new TestServer(builder); var httpClient = testServer.CreateClient(); _sut = new BasketClient(httpClient); }
/// <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); }
public async Task OnGet([FromServices] IBasketClient client) { try { BasketContents = await client.GetBasketForCustomer(1); } catch (Exception) { BasketContents = "Basket Service Unavailable"; } }
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; }
public ScanManager(IBasketClient client) { this.client = client; }
public OrdersController(IOrderClient orderClient, IBasketClient basketClient, IConfiguration config) { _orderClient = orderClient; _basketClient = basketClient; _userName = config["userName"] ?? "defaultUser"; }
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"; }
public Form1(IBasketClient client) { InitializeComponent(client); }