Esempio n. 1
0
        public static void Main(string[] args)
        {
            IDog poodle = dogs.GetDog("small");

            poodle.Speak();

            IDog rottweiler = dogs.GetDog("big");

            rottweiler.Speak();

            IDog husky = dogs.GetDog("working");

            husky.Speak();

            IDog doggo = dogs.GetDog("cute fluffy doggo");

            try {
                doggo.Speak();
            } catch (NullReferenceException) {
                Console.WriteLine("There is no dog there! *BREATHING INTENSIFIES*");
            }

            Library library  = new Library("Tartu");
            Book    potter   = new Book("Harry Potter and the Order of the Phoenix");
            Book    bullerby = new Book("Bullerby lapsed", "Astrid Lindgren");

            library.AddBook(potter);
            library.AddBook(bullerby);

            library.BorrowBook("Potter");
        }
        public void DogFactoryNullTest()
        {
            DogFactory dogFactory = new DogFactory();

            IDog d = dogFactory.GetDog(Dogs.none);

            Assert.IsNull(d);
        }
        public void DogFactoryWolfhoundTest()
        {
            DogFactory dogFactory = new DogFactory();

            IDog d = dogFactory.GetDog(Dogs.Wolfhound);

            Assert.IsInstanceOfType(d, typeof(Wolfhound));
        }
        public void DogFactoryPoodleTest()
        {
            DogFactory dogFactory = new DogFactory();

            IDog d = dogFactory.GetDog(Dogs.Poodle);

            Assert.IsInstanceOfType(d, typeof(Poodle));
        }
        public void DogFactoryCollieTest()
        {
            DogFactory dogFactory = new DogFactory();

            IDog d = dogFactory.GetDog(Dogs.Collie);

            Assert.IsInstanceOfType(d, typeof(Collie));
        }