Exemplo n.º 1
0
        public void Test_DeserializeCollectionAndObjectFromBinaryFile()
        {
            BooksCollection <Book> resultCollection = Serializer <BooksCollection <Book> > .DeserializeFromBinary(_binaryCollectionPath);

            Book result = Serializer <Book> .DeserializeFromBinary(_binaryPath);

            Assert.AreEqual(resultCollection, _booksCollection);
            Assert.AreEqual(result, _book);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string welcome        = "Welcome in Book Library!";
            var    bookCollection = BooksCollection.InitializeLibrary(welcome);

            Console.WriteLine("If you want to view all Books -> Press 1");
            Console.WriteLine("If you want to view all Novels -> Press 2");
            Console.WriteLine("If you want to view all Story collection -> Press 3");
            Console.WriteLine("If you want to view all Anthologies -> Press 4");

            int userChoise = Convert.ToInt32(Console.ReadLine());

            bookCollection.ShowAllBooks(userChoise);
            Console.ReadLine();
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            booksCollection            = new BooksCollection();
            booksListForm              = new BooksListForm(this);
            booksListForm.WindowState  = FormWindowState.Maximized;
            booksListForm.FormClosing += (sender, e) => { childViewClosing(sender as Form, e); };

            currentView = booksListForm;
            booksListForm.RegisterForItemCountChanges(UpdateStatusBar);

            openViewsCount    = 1;
            MdiChildActivate += setStatusBarSource;
            booksListForm.Show();
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            _booksCollection = new BooksCollection <Book>(new List <Book>
            {
                new Book()
                {
                    FullName       = "1",
                    Genre          = "4",
                    PlaceOfWriting = "Minsk",
                    Price          = 123.45m
                },
                new Book()
                {
                    FullName       = "2",
                    Genre          = "5",
                    PlaceOfWriting = "Gomel",
                    Price          = 666.66m
                },
                new Book()
                {
                    FullName       = "3",
                    Genre          = "6",
                    PlaceOfWriting = "Brest",
                    Price          = 9999.99m
                }
            });

            _booksArray = new Book[]
            {
                new Book()
                {
                    FullName       = "2",
                    Genre          = "5",
                    PlaceOfWriting = "Gomel",
                    Price          = 666.66m
                },

                new Book()
                {
                    FullName       = "3",
                    Genre          = "6",
                    PlaceOfWriting = "Brest",
                    Price          = 9999.99m
                },

                new Book(),
            };
        }
Exemplo n.º 5
0
        public void Setup()
        {
            _binaryPath = @"..\..\..\..\EPAM_Task5\Task2\Resources\BinaryFile.dat";
            _xmlPath    = @"..\..\..\..\EPAM_Task5\Task2\Resources\XmlFile.xml";
            _jsonPath   = @"..\..\..\..\EPAM_Task5\Task2\Resources\JsonFile.json";

            _binaryCollectionPath = @"..\..\..\..\EPAM_Task5\Task2\Resources\BinaryFileCollection.dat";
            _xmlCollectionPath    = @"..\..\..\..\EPAM_Task5\Task2\Resources\XmlFileCollection.xml";
            _jsonCollectionPath   = @"..\..\..\..\EPAM_Task5\Task2\Resources\JsonFileCollection.json";

            _book = new Book()
            {
                FullName       = "Ivan",
                Genre          = "gsfgaaaaa",
                PlaceOfWriting = "OOO"
            };

            _booksCollection = new BooksCollection <Book>(new List <Book>
            {
                new Book()
                {
                    FullName       = "fsfsdf",
                    Genre          = "sgsgsfg",
                    PlaceOfWriting = "sgsgs"
                },

                new Book()
                {
                    FullName       = "ldmbslk",
                    Genre          = "sghhgdgs",
                    PlaceOfWriting = "htyhfbg"
                },

                new Book()
                {
                    FullName       = "gwpgjwn",
                    Genre          = "pvww",
                    PlaceOfWriting = "vnxcmvbsdl"
                }
            });
        }
Exemplo n.º 6
0
 public void Insert(params Book[] books)
 {
     BooksCollection.InsertMany(books);
 }