Quellcode durchsuchen

TestingComplete

galoc vor 2 Wochen
Ursprung
Commit
7bba742d3d
1 geänderte Dateien mit 41 neuen und 14 gelöschten Zeilen
  1. 41 14
      TestProject1/UnitTest1.cs

+ 41 - 14
TestProject1/UnitTest1.cs

@@ -2,6 +2,7 @@
 using Supabase;
 using Supabase.Gotrue;
 using Supabase.Interfaces;
+using Supabase.Postgrest;
 using Supabase.Postgrest.Attributes;
 using Supabase.Postgrest.Models;
 using Supabase.Postgrest.Responses;
@@ -174,27 +175,53 @@ namespace TestProject1
         }
         //UT 8
 
-        public async Task<ModeledResponse<Genders>> InsertGenders()
+        public async Task<ModeledResponse<Users>> UpdateUser()
         {
-            var genders = new Genders
-            {
-                Id = 100,
-                Title = "Êàðáîíàðà",
-            };
-            return await supabase.From<Genders>().Upsert(genders);
+            return await supabase
+            .From<Users>()
+            .Where(x => x.login == "aloha123")
+            .Set(x => x.login, "aloha1234")
+            .Update();
         }
         [TestMethod]
-        public async Task GendersInsert()
+        public async Task UserUpdate()
         {
-            var url = "https://unmeiceifhurzmiokboh.supabase.co";
-            var key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVubWVpY2VpZmh1cnptaW9rYm9oIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzA5MDU0MDUsImV4cCI6MjA0NjQ4MTQwNX0._7UneKbsr9O1DVE0OrlrRD5ZZlYrLWDOC1T-IJmJqvA";
-            var options = new Supabase.SupabaseOptions
+            Initialize();
+            var result = await UpdateUser();
+
+        }
+        //UT 9
+        public async Task<ModeledResponse<DishesBlog>> UpdateDishesBlog()
+        {
+            return await supabase
+            .From<DishesBlog>()
+            .Where(x => x.Name == "Çàïåêàíî÷êà")
+            .Set(x => x.Name, "Çàïåêàíêà")
+            .Update();
+        }
+        [TestMethod]
+        public async Task DishesBlogUpdate()
+        {
+            Initialize();
+            var result = await UpdateDishesBlog();
+
+        }
+
+        //UT 10
+        public async Task<ModeledResponse<Genders>> CreateGender()
+        {
+            var model = new Genders
             {
-                AutoConnectRealtime = true
+                Title = "Íå óêàçàíî",
             };
-            var supabase = new Supabase.Client(url, key, options);
+
+            return await supabase.From<Genders>().Insert(model);
+        }
+        [TestMethod]
+        public async Task GenderCreate()
+        {
             Initialize();
-            var result = await InsertGenders();
+            var result = await CreateGender();
         }
     }
 }