UnitTest1.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Supabase;
  2. using Supabase.Postgrest.Attributes;
  3. using Supabase.Postgrest.Models;
  4. using Supabase.Postgrest.Responses;
  5. using Supabase.Realtime;
  6. using System.ComponentModel;
  7. using System.Reflection;
  8. namespace TestProject1
  9. {
  10. [TestClass]
  11. public class UnitTest1
  12. {
  13. static string url = "https://mkrrkgiaewskfaslstgx.supabase.co";
  14. static string key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1rcnJrZ2lhZXdza2Zhc2xzdGd4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjkxNjExMDYsImV4cCI6MjA0NDczNzEwNn0.G6-C-LDzQBTuNAOcE83gZIjWUTiDpYWYa1Rjp4M5Kx0";
  15. static Supabase.SupabaseOptions options = new Supabase.SupabaseOptions
  16. {
  17. AutoConnectRealtime = true
  18. };
  19. Supabase.Client supabase = new Supabase.Client(url, key, options);
  20. public async void Initialize()
  21. {
  22. await supabase.InitializeAsync();
  23. }
  24. public async Task<ModeledResponse<Label>> Get()
  25. {
  26. return await supabase.From<Label>().Get();
  27. }
  28. [TestMethod]
  29. public void TestLabels()
  30. {
  31. Initialize();
  32. Task<ModeledResponse<Label>> result = Get();
  33. result.Wait();
  34. var labels = result.Result.Models;
  35. Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(labels);
  36. }
  37. }
  38. }