コード例 #1
0
        public void AddProcessStateTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog      catalog         = new Catalog("Andrzej", "Sapkowski", 2000, "The Witcher", 8);
            ProcessState processState    = new ProcessState(catalog, "Znak", 1990, "Good");

            test.AddProcessState(processState);

            Assert.AreEqual(test.ReadProcessState(5), processState);
        }
コード例 #2
0
        public void UpdateProcessStateTest()
        {
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DataChamber           data   = new DataChamber();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog      newCatalog      = new Catalog("Lokok", "Test", 1908, "Testowy", 9);
            ProcessState newProcessState = new ProcessState(newCatalog, "Testowy", 1789, "Bad");

            test.UpdateProcessState(4, newProcessState);

            Assert.AreEqual(newProcessState, test.ReadProcessState(4));
        }
コード例 #3
0
        public void DeleteProcessStateTest()
        {
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DataChamber           data   = new DataChamber();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog      newCatalog      = new Catalog("Lokok", "Test", 1908, "Testowy", 9);
            ProcessState newProcessState = new ProcessState(newCatalog, "Testowy", 1789, "Bad");

            test.AddProcessState(newProcessState);
            Assert.AreEqual(test.ReadProcessState(5), newProcessState);

            test.DeleteProcessState(5);
            Assert.IsFalse(test.ReadAllProcessStates().Contains(newProcessState));
        }
コード例 #4
0
        public void ReadProcessStateTest()
        {
            DataChamber           data             = new DataChamber();
            DefaultDataGeneration filler           = new DefaultDataGeneration();
            DatabaseActions       test             = new DatabaseActions(data, filler);
            ProcessState          readProcessState = test.ReadProcessState(3);

            Assert.AreEqual(readProcessState.getCatalog().getAuthorsName(), "Harper");
            Assert.AreEqual(readProcessState.getCatalog().getAuthorsSurname(), "Lee");
            Assert.AreEqual(readProcessState.getCatalog().getTitle(), "To Kill a Mockingbird");
            Assert.AreEqual(readProcessState.getCatalog().getPublicationDate(), 1960);
            Assert.AreEqual(readProcessState.getCatalog().getKey(), 1);
            Assert.AreEqual(readProcessState.getPublisher(), "Znak");
            Assert.AreEqual(readProcessState.getBookState(), "Bad");
            Assert.AreEqual(readProcessState.getReleaseDate(), 2001);
        }