Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.8 kB
6
Indexable
Never
using System;
using System.Collections.Generic;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string doktor1 = "Pero peric";
            string napomena1 = "napomena 1";

            ZahtjevDoktora doktorA = new() { Reason = doktor1, Email = napomena1};

            ZahtjevDoktora zahtjev = new ZahtjevDoktora();
            zahtjev.Email = "email";
            zahtjev.Reason = "reson";

            OdabirDoktora(driver, zahtjev);

        }

        public static void OdabirDoktora(IWebDriver driver, ZahtjevDoktora zahtjev)
        {
            var izbor = new NewDoctorRequest(driver);
            if (zahtjev.Reason == "01")
                TestCase1.OdabirOsobe(driver, "58962605964");
            else
                TestCase1.OdabirOsobe(driver, "05467164050");

            izbor._btnNewDoctorRequest.Click();
            izbor._email.SendKeys(zahtjev.Email);
            izbor._date.Click();
            izbor._datePicker.Click();
            izbor._denialRequest.SendKeys(zahtjev.DenialReq);

            if (zahtjev.IsPotential)
            {
                izbor._btnNewPotRequest.Click();
                izbor._doctorPotEnterCode.SendKeys(doctorCode);
                izbor._doctorPotLoad.Click();
                Thread.Sleep(1000);
            }
            else
            {
                Thread.Sleep(500);
                izbor._requestReason.SendKeys(reason);
                izbor._selectReason.Click();
                izbor._doctorEnterCode.SendKeys(doctorCode);
                izbor._doctorLoad.Click();
                izbor._teamEnterCode.SendKeys(teamCode);
                Thread.Sleep(1000);
                izbor._teamLoad.Click();
            }
            izbor._btnCreate.Click();
            Thread.Sleep(500);
            izbor._btnConfirm.Click();

            if (reason == "06")
                Assert.IsTrue(izbor._requestStatus.Text.Contains("7 - Posebno povjerenstvo"));
            else if (reason == "16")
                Assert.IsTrue(izbor._requestStatus.Text.Contains("6 - Dodatna provjera"));
            else
                Assert.IsTrue(izbor._requestStatus.Text.Contains("8 - Proveden"));
        }

        public static void OdabirDoktora(IWebDriver driver, List<ZahtjevDoktora> zahtjevi)
        {
            foreach (var zahtjev in zahtjevi)
                OdabirDoktora(driver, zahtjev);
        }
    }

    public class ZahtjevDoktora
    { 
        public string Reason { get; set; }
        public string Email { get; set; }
        public string DoctorCode { get; set; }
        public string TeamCode { get; set; }
        public bool IsPotential { get; set; }
        public string DenialReq { get; set; }
    }
}