コード例 #1
0
        public void UpdateEventTest()
        {
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DataChamber           data   = new DataChamber();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Users        newUser         = new Users(1, "Test", "Testowy", 1908);
            Catalog      newCatalog      = new Catalog("Lokok", "Test", 1908, "Testowy", 9);
            ProcessState newProcessState = new ProcessState(newCatalog, "Testowy", 1789, "Bad");
            DateTime     checkOutDate    = new DateTime(2000, 10, 12);
            DateTime     checkInDate     = new DateTime(1990, 4, 6);
            Event        newEvent        = new Event(newProcessState, newUser, checkOutDate, checkInDate);

            test.UpdateEvent(2, newEvent);

            Assert.AreEqual(newEvent, test.ReadEvent(2));
        }
コード例 #2
0
        public void AddEventTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Users        user            = new Users(1, "Wojciech", "Mincikiewicz", 1996);
            Catalog      catalog         = new Catalog("Andrzej", "Sapkowski", 2000, "The Witcher", 8);
            ProcessState processState    = new ProcessState(catalog, "Znak", 1990, "Good");
            DateTime     checkOutDate    = new DateTime(2010, 10, 12);
            DateTime     checkInDate     = new DateTime(1993, 4, 6);
            Event        evn             = new Event(processState, user, checkOutDate, checkInDate);

            test.AddEvent(evn);

            Assert.AreEqual(test.ReadEvent(5), evn);
        }
コード例 #3
0
        public void ReadEventTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            DateTime checkOutDate        = new DateTime(2018, 4, 6);
            DateTime checkInDate         = new DateTime(2018, 12, 12);
            Event    readEvent           = test.ReadEvent(3);

            Assert.AreEqual(readEvent.getProcessState().getCatalog().getAuthorsName(), "George");
            Assert.AreEqual(readEvent.getProcessState().getCatalog().getAuthorsSurname(), "Orwell");
            Assert.AreEqual(readEvent.getProcessState().getCatalog().getTitle(), "1984");
            Assert.AreEqual(readEvent.getProcessState().getCatalog().getPublicationDate(), 1949);
            Assert.AreEqual(readEvent.getProcessState().getCatalog().getKey(), 2);
            Assert.AreEqual(readEvent.getProcessState().getPublisher(), "Amber");
            Assert.AreEqual(readEvent.getProcessState().getBookState(), "Average");
            Assert.AreEqual(readEvent.getProcessState().getReleaseDate(), 1986);
            Assert.AreEqual(readEvent.getUsers().getName(), "Kasia");
            Assert.AreEqual(readEvent.getUsers().getSurname(), "Kowalska");
            Assert.AreEqual(readEvent.getUsers().getDate(), 1993);
            Assert.AreEqual(readEvent.getUsers().getId(), 1);
            Assert.AreEqual(readEvent.getCheckOutDate(), checkOutDate);
            Assert.AreEqual(readEvent.getCheckInDate(), checkInDate);
        }