using Library;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnitTests
{
    [TestClass]
    public class CardsTests
    {
        private readonly ICardService _cardsService;

        public CardsTests()
        {
            var url = "https://eykhnnlgofgxdzlixydt.supabase.co";
            var key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjkyMzQ4NzgsImV4cCI6MjA0NDgxMDg3OH0.gG_nBmJ1KjC3se3HHNoBJLN8UA-aTw7JJw9PIMwJoL0";

            // Создаем экземпляр SupabaseClientFactory и GenderService
            var factory = new SupabaseClientFactory(url, key);
            var client = factory.CreateClient();
            _cardsService = new CarsService(client);
        }

        [TestMethod]
        public async Task GetAllCardsAsync_ReturnsCards_WhenDataExists()
        {
            var cards = await _cardsService.GetAllCardsAsync();

            Assert.IsNotNull(cards);
            Assert.AreEqual(cards[0].Title, "Двойка жезлов");
            Assert.IsNotNull(cards[0].Image);
            Assert.AreEqual(cards[0].Id_arcan, 2);
            Assert.AreEqual(cards[0].Id_suit, 1);

        }
    }
}
