static void Main(string[] args)
        {
            Console.WriteLine("Moikka Visual Studiosta!");

            Laskenta laskenta = new Laskenta();
            int      summa    = laskenta.Summa(100, 234);

            Console.WriteLine("Summa on: " + summa);

            Console.ReadLine();
        }
Exemple #2
0
        public void SummaTest()
        {
            int a = 100;
            int b = 200;

            Laskenta l     = new Laskenta();
            int      summa = l.Summa(a, b);

            int odotettu = a + b;

            Assert.AreEqual(odotettu, summa);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            //Testaa()
            bool jatka;

            if (args.Length == 0)
            {
                jatka = false;
            }
            else
            {
                jatka = true;
            }

            var      connectionString = ConfigurationManager.ConnectionStrings["VipunenTK_DW"].ConnectionString;
            Laskenta l = new Laskenta();

            l.LaskeTiivistetytRivit(connectionString, jatka);

            Console.WriteLine("Paina mitä tahansa näppäintä sulkeaksesi ikkunan");
            Console.ReadKey();
        }
Exemple #4
0
        public void SummaTest()
        {
            int[] a = { -2, -1, 0, 1, 2, 3, -1, 1 };
            int[] b = { -200, -100, 0, 100, 200, 300, 1, -1 };

            for (int indeksi = 0; indeksi < a.Length; indeksi++)
            {
                int luku1 = a[indeksi];
                int luku2 = b[indeksi];

                Debug.WriteLine($"Testitapaus {indeksi}: luvut = {luku1}, {luku2}.");

                try
                {
                    Laskenta l     = new Laskenta();
                    int      summa = l.Summa(luku1, luku2);

                    if ((luku1 < 0) || (luku2 < 0))
                    {
                        Assert.Fail();
                    }
                    else
                    {
                        int odotettu = luku1 + luku2;
                        Assert.AreEqual(odotettu, summa);
                    }
                }
                catch (Exception ex)
                {
                    if (!(ex is ArgumentOutOfRangeException))
                    {
                        Assert.Fail();
                    }
                }
            }
        }