using Supabase; using Supabase.Postgrest.Attributes; using Supabase.Postgrest.Models; using Supabase.Postgrest.Responses; using Supabase.Realtime; using System.ComponentModel; using System.Reflection; namespace TestProject1 { [TestClass] public class UnitTest1 { static string url = "https://hsaisodnnhmqcusypnar.supabase.co"; static string key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImhzYWlzb2RubmhtcWN1c3lwbmFyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjkxNjE0NzQsImV4cCI6MjA0NDczNzQ3NH0.KfjnJiEouhdAT4isU-QLWT6RKl0zaSFmulZzHu8tDg0"; static Supabase.SupabaseOptions options = new Supabase.SupabaseOptions { AutoConnectRealtime = true }; Supabase.Client supabase = new Supabase.Client(url, key, options); public async void Initialize() { await supabase.InitializeAsync(); } public async Task> Get1() { return await supabase.From().Get(); } public async Task> Get2() { return await supabase.From().Get(); } public async Task> Get3() { return await supabase.From().Get(); } public async Task> Get4() { return await supabase.From().Get(); } public async Task> Get5() { return await supabase.From().Get(); } [TestMethod] public void TestMovie() { Initialize(); Task> result = Get1(); result.Wait(); var rez = result.Result.Models; Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(rez); } [TestMethod] public void TestExhibition() { Initialize(); Task> result = Get2(); result.Wait(); var rez = result.Result.Models; Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(rez); } [TestMethod] public void TestRestaurants() { Initialize(); Task> result = Get3(); result.Wait(); var rez = result.Result.Models; Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(rez); } [TestMethod] public void TestBenchs() { Initialize(); Task> result = Get4(); result.Wait(); var rez = result.Result.Models; Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(rez); } [TestMethod] public void TestConcerts() { Initialize(); Task> result = Get5(); result.Wait(); var rez = result.Result.Models; Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(rez); } [TestMethod] public async Task TestInsertBenchs() { var bench = new Benchs { id = 7, district = "Московский", coordinates = "ул. Березовская, 102А.", state = "отличное", picture = "test_picture_url" }; var result = await supabase.From().Insert(bench); Assert.IsNotNull(result.Models); Assert.IsTrue(result.Models.Count > 0, "Ошибка!"); } [TestMethod] public async Task TestInsertMovies() { var movie = new Movie { id = 5, name = "Преступление и наказание", genre = "триллер", price = "от 400 руб.", date = "с 26 октября.", picture = "test_picture_url" }; var result = await supabase.From().Insert(movie); Assert.IsNotNull(result.Models); Assert.IsTrue(result.Models.Count > 0, "Ошибка!"); } [TestMethod] public async Task TestInsertConcerts() { var concert = new Concerts { id = 9, singer = "Егор Крид", genre = "поп", price = "от 4500 руб.", date = "2024-11-27 20:00", picture = "test_picture_url" }; var result = await supabase.From().Insert(concert); Assert.IsNotNull(result.Models); Assert.IsTrue(result.Models.Count > 0, "Ошибка!"); } [TestMethod] public async Task TestInsertRestaurants() { var rest = new Restaurants { id = 8, name = "Колхида", location = "ул. Нестерова, 23.", cuisin = "грузинская", picture = "test_picture_url" }; var result = await supabase.From().Insert(rest); Assert.IsNotNull(result.Models); Assert.IsTrue(result.Models.Count > 0, "Ошибка!"); } } }