Beispiel #1
0
        static void Main(string[] args)
        {
            Book test = new Book();
            Book livre2 = new Book();
            Publisher editeur = new Publisher { Ca = 523698.4, Name = "Edition M2i" };

            Author guillaume = new Author { FirstName = "Guillaume", LastName = "Tel" };
            Author arthur = new Author { FirstName = "Arthur", LastName = "Le Roi" };
            Author maurice = new Author { FirstName = "Maurice", LastName = "Momo" };

            test.Title = "ceci est le titre de mon livre";
            test.NbPage = 957;
            test.Editor = editeur;
            test.DisplayAuthor();
            try
            {
                test.AddAuthor(guillaume);
                test.AddAuthor(arthur);
                for (int prout = 0; prout < 11; prout++)
                {
                    livre2.AddAuthor(maurice);
                }
            }
            catch (MediaException e)
            {
                Console.WriteLine(e.StackTrace);
            }

            Console.WriteLine(test.Title);
            Console.WriteLine("Il possede a : " + test.NbPage + " pages");
            Console.WriteLine("Editor name : " + test.Editor.Name);
            test.DisplayAuthor();
            Console.ReadKey();

            Console.WriteLine( Counter.increment() );
            Console.WriteLine( Counter.increment() );
            Console.ReadKey();

            test.Category = BookCategory.Poem;
            Console.WriteLine(test.Category );
            Console.ReadKey();

            Point3D p3d = new Point3D();
            p3d.X = 5;
            p3d.Z = 9;

            Media b2 = new Book();
            b2.Price = 10.0;
            Console.WriteLine(((Book)b2).NbPage);
            Console.WriteLine(b2.VATPrice);
            Console.ReadKey();
        }
        public IDictionary<String, Book> mapTest()
        {
            IDictionary<String, Book> map = new Dictionary<String, Book>();
            Book b1 = new Book();
            Book b2 = new Book();
            Book b3 = new Book();
            Book b4 = new Book();

            b1.Name = ("Premier Livre");
            b2.Name = ("Deuxieme Livre");
            b3.Name = ("Troisieme Livre");
            b4.Name = ("Quatrieme Livre");

            map.Add("one", b1);
            map.Add("two", b2);
            map.Add("three", b3);
            map.Add("four", b1);

            map.Remove("four");

            return map;
        }
        public ISet<Book> setTest()
        {
            ISet<Book> set = new HashSet<Book>();
            Book b1 = new Book();
            Book b2 = new Book();
            Book b3 = new Book();
            Book b4 = new Book();

            b1.Name = ("Premier Livre");
            b2.Name = ("Deuxieme Livre");
            b3.Name = ("Troisieme Livre");
            b4.Name = ("Quatrieme Livre");

            set.Add(b1);
            set.Add(b2);
            set.Add(b3);
            set.Add(b1);

            set.Remove(b2);

            return set;
        }
        public IList<Book> listTest()
        {
            IList<Book> liste = new List<Book>();
            Book b1 = new Book();
            Book b2 = new Book();
            Book b3 = new Book();
            Book b4 = new Book();

            b1.Name = "Premier Livre";
            b2.Name = "Deuxieme Livre";
            b3.Name = "Troisieme Livre";
            b4.Name = "Quatrieme Livre";

            liste.Add(b1);
            liste.Add(b2);
            liste.Add(b3);
            liste.Insert(1, b4);

            liste.RemoveAt(2);

            return liste;
        }