You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

  1. using Microsoft.AspNetCore.Hosting;
  2. using Microsoft.AspNetCore.TestHost;
  3. using Microsoft.Extensions.Configuration;
  4. using System.IO;
  5. using System.Reflection;
  6. namespace FunctionalTests.Services.Basket
  7. {
  8. public class BasketScenariosBase
  9. {
  10. private const string ApiUrlBase = "api/v1/basket";
  11. public TestServer CreateServer()
  12. {
  13. var path = Assembly.GetAssembly(typeof(BasketScenariosBase))
  14. .Location;
  15. var hostBuilder = new WebHostBuilder()
  16. .UseContentRoot(Path.GetDirectoryName(path))
  17. .ConfigureAppConfiguration(cb =>
  18. {
  19. cb.AddJsonFile("Services/Basket/appsettings.json", optional: false)
  20. .AddEnvironmentVariables();
  21. }).UseStartup<BasketTestsStartup>();
  22. return new TestServer(hostBuilder);
  23. }
  24. public static class Get
  25. {
  26. public static string GetBasket(int id)
  27. {
  28. return $"{ApiUrlBase}/{id}";
  29. }
  30. public static string GetBasketByCustomer(string customerId)
  31. {
  32. return $"{ApiUrlBase}/{customerId}";
  33. }
  34. }
  35. public static class Post
  36. {
  37. public static string CreateBasket = $"{ApiUrlBase}/";
  38. public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
  39. }
  40. }
  41. }