예제 #1
0
        public void DefaultFillTest()
        {
            DefaultDataGeneration defaultDataGeneration = new DefaultDataGeneration();
            DataChamber           chamber         = new DataChamber();
            DatabaseActions       databaseActions = new DatabaseActions(chamber, defaultDataGeneration);

            Assert.AreEqual(5, databaseActions.ReadAllCatalogs().Count);
            Assert.AreEqual(5, databaseActions.ReadAllUsers().Count);
            Assert.AreEqual(5, databaseActions.ReadAllProcessStates().Count);
            Assert.AreEqual(5, databaseActions.ReadAllEvents().Count);
        }
예제 #2
0
        public void RandomFillTest()
        {
            RandomDataGeneration ranDataGeneration = new RandomDataGeneration();
            DataChamber          chamber           = new DataChamber();
            DatabaseActions      databaseActions   = new DatabaseActions(chamber, ranDataGeneration);

            Assert.AreEqual(10, databaseActions.ReadAllCatalogs().Count);
            Assert.AreEqual(10, databaseActions.ReadAllUsers().Count);
            Assert.AreEqual(10, databaseActions.ReadAllProcessStates().Count);
            Assert.AreEqual(10, databaseActions.ReadAllEvents().Count);
        }
        public void ReadAllEventsTest()
        {
            DefaultDataGeneration     filler            = new DefaultDataGeneration();
            List <Users>              usersList         = new List <Users>();
            Dictionary <int, Catalog> catalogDictionary = new Dictionary <int, Catalog>();
            List <Event>              eventsList        = new List <Event>();
            List <ProcessState>       processStateList  = new List <ProcessState>();
            DataChamber data = new DataChamber(usersList, catalogDictionary, eventsList, processStateList);

            DatabaseActions test = new DatabaseActions(data, filler);

            Assert.AreEqual(eventsList, test.ReadAllEvents());
        }
        public void DeleteEventTest()
        {
            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.AddEvent(newEvent);
            Assert.AreEqual(test.ReadEvent(5), newEvent);

            test.DeleteEvent(5);
            Assert.IsFalse(test.ReadAllEvents().Contains(newEvent));
        }