public void TestAntalInvånare()
        {
            Invånare i = new Invånare();

            i.AntalInvånare(2016);

            Assert.AreEqual(26313, i.AntalInvånare(2016));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //Uppgift 1
            Invånare i = new Invånare();

            Console.WriteLine("Ange s**tår");
            try { var s**tår = int.Parse(Console.ReadLine());

                  Console.WriteLine("Antalet invånare mellan 2015 och " + s**tår + " är " + i.AntalInvånare(s**tår)); }
            catch
            {
                throw new FormatException("Felaktigt inmating");
            }
            Console.ReadKey();
            // Uppgift 2
            Temprature temp = new Temprature();

            Console.Write("Ange en temperatur ");
            try {
                var angiventemp = int.Parse(Console.ReadLine());
                temp.CheckTemp(angiventemp);
            }
            catch
            {
                throw new FormatException("Felaktigt inmating");
            }
            Console.ReadKey();

            //Uppgift 7
            Grönalund g = new Grönalund();

            Console.WriteLine("Ange Ålder");
            try
            {
                g.ålder(int.Parse(Console.ReadLine()));

                Console.WriteLine("Vill du fortsätta? Ja för att forsätta Nej för att gå vidare till betalning.");
                g.val(Console.ReadLine().ToLower());
            }
            catch
            {
                throw new Exception("Något gick fel, har du fyllt i informationen rätt");
            }
            Console.ReadKey();
        }
 public void setup()
 {
     i = new Invånare();
 }