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.

51 lines
1.4 KiB

  1. namespace FunctionalTests.Services.Locations
  2. {
  3. using Microsoft.AspNetCore;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.AspNetCore.TestHost;
  6. using Microsoft.Extensions.Configuration;
  7. using System;
  8. using System.IO;
  9. using System.Reflection;
  10. public class LocationsScenariosBase
  11. {
  12. public TestServer CreateServer()
  13. {
  14. var path = Assembly.GetAssembly(typeof(LocationsScenariosBase))
  15. .Location;
  16. var hostBuilder = new WebHostBuilder()
  17. .UseContentRoot(Path.GetDirectoryName(path))
  18. .ConfigureAppConfiguration(cb =>
  19. {
  20. cb.AddJsonFile("Services/Location/appsettings.json", optional: false)
  21. .AddEnvironmentVariables();
  22. }).UseStartup<LocationsTestsStartup>();
  23. var testServer = new TestServer(hostBuilder);
  24. return testServer;
  25. }
  26. public static class Get
  27. {
  28. public static string Locations = "api/v1/locations";
  29. public static string LocationBy(string id)
  30. {
  31. return $"api/v1/locations/{id}";
  32. }
  33. public static string UserLocationBy(Guid id)
  34. {
  35. return $"api/v1/locations/user/{id}";
  36. }
  37. }
  38. public static class Post
  39. {
  40. public static string AddNewLocation = "api/v1/locations/";
  41. }
  42. }
  43. }