Exemplo n.º 1
0
 public void TestConst2()
 {
     Posiljaoc  p      = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
     Let        l      = new Let(9363, 4, 0.125, 2);
     double     cijena = l.izracunajCijenu();
     UneseniLet ul     = new UneseniLet(p, l, 1, cijena);
 }
Exemplo n.º 2
0
 public void evidentirajLet(UneseniLet ul)
 {
     if (potvrdiLet(ul.posiljaoc.JMBG, ul.let.distanca, ul.let.klasa) && !letPostoji(ul.ID))
     {
         letovi.Add(ul);
     }
 }
Exemplo n.º 3
0
        public void TestPosiljalacEx()
        {
            UneseniLet ul = new UneseniLet();
            Posiljaoc  p  = null;
            Let        l  = new Let(9363, 4, 0.125, 2);

            ul.posiljaoc = p;
            Assert.AreEqual(ul.posiljaoc, p);
        }
Exemplo n.º 4
0
        public void TestCons()
        {
            Let        l      = new Let(9363, 4, 0.125, 2);
            Posiljaoc  p      = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
            double     cijena = l.izracunajCijenu();
            UneseniLet ul     = new UneseniLet(p, l, 1, cijena);
            Lufthansa  lf     = new Lufthansa();

            lf.letovi.Add(ul);
        }
Exemplo n.º 5
0
        public void TestWriteXML()
        {
            Let        l      = new Let(9363, 4, 0.125, 2);
            Posiljaoc  p      = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
            double     cijena = l.izracunajCijenu();
            UneseniLet ul     = new UneseniLet(p, l, 1, cijena);
            Lufthansa  lf     = new Lufthansa();

            lf.letovi.Add(ul);
            XMLSerialization.WriteXML <List <UneseniLet> >(lf.letovi);
        }
Exemplo n.º 6
0
        public void TestCijenaEx2()
        {
            UneseniLet ul = new UneseniLet();
            Posiljaoc  p  = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
            Let        l  = new Let(9363, 4, 0.125, 2);

            ul.posiljaoc = p;
            ul.let       = l;
            ul.cijena    = 1220;
            double cijena = 1280.15;

            Assert.AreEqual(ul.cijena, cijena);
        }
Exemplo n.º 7
0
        public void TestMock()
        {
            Lufthansa lf = new Lufthansa();

            service = new MockLetoviService();

            Posiljaoc  p  = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
            Let        l  = new Let(9363, 4, 0.125, 2);
            UneseniLet ul = new UneseniLet(p, l, 20, l.izracunajCijenu());

            lf.letovi.Add(ul);
            if (service.potvrdiLet(p.JMBG, l.distanca, l.klasa))
            {
                service.evidentirajLet(ul);
            }

            Assert.AreEqual(lf.letovi.Count, service.brojac()); //spy
            Assert.IsTrue(service.letPostoji(ul.ID));
        }
Exemplo n.º 8
0
        public void TestGet()
        {
            UneseniLet ul  = new UneseniLet();
            UneseniLet ul2 = new UneseniLet();
            Let        l   = new Let(9363, 4, 0.125, 2);
            Let        l2  = new Let(9363, 4, 0.125, 2);
            Posiljaoc  p   = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");
            Posiljaoc  p2  = new Posiljaoc("Amela", "Spica", "2901994175003", "+38762-282-330", "bla");

            int id = 0;

            ul.let  = l;
            ul2.let = l2;

            ul.ID = id;

            ul.posiljaoc  = p;
            ul2.posiljaoc = p2;

            Assert.AreEqual(ul.let, ul2.let);
            Assert.AreEqual(ul.posiljaoc, ul2.posiljaoc);
            Assert.AreEqual(ul.ID, 0);
        }
Exemplo n.º 9
0
        public void XMLCitanje_DataDrivenTest()
        {
            int    id       = Convert.ToInt32(TestContext.DataRow["ID"]);
            string ime      = Convert.ToString(TestContext.DataRow["ime"]);
            string prezime  = Convert.ToString(TestContext.DataRow["prezime"]);
            string jmbg     = TestContext.DataRow["JMBG"].ToString();
            double distanca = Convert.ToDouble(TestContext.DataRow["distanca"]);
            int    klasa    = Convert.ToInt32(TestContext.DataRow["klasa"]);
            Let    l        = new Let(Convert.ToDouble(TestContext.DataRow["distanca"]),
                                      Convert.ToInt32(TestContext.DataRow["prtljag"]),
                                      Convert.ToDouble(TestContext.DataRow["taksa"]),
                                      Convert.ToInt32(TestContext.DataRow["klasa"]));
            Posiljaoc p = new Posiljaoc(ime, prezime, jmbg,
                                        TestContext.DataRow["kontakt"].ToString(),
                                        TestContext.DataRow["komentar"].ToString());
            double     cijena = Convert.ToDouble(TestContext.DataRow["cijena"]);
            UneseniLet ul     = new UneseniLet(p, l, id, cijena);

            service.evidentirajLet(ul);
            //provjera da li postoji let
            Assert.IsTrue(service.letPostoji(id));
            Assert.IsTrue(service.potvrdiLet(jmbg, distanca, klasa));
        }
Exemplo n.º 10
0
        public void TestIDex()
        {
            UneseniLet ul = new UneseniLet();

            ul.ID = -1;
        }