Exemplo n.º 1
0
        public void CreateTest()
        {
            IFile   XmlFile      = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.xml);
            Student addedStudent = XmlFile.Create(student);

            Assert.AreEqual(student, addedStudent);
        }
Exemplo n.º 2
0
        private void BtnList_Click(object sender, EventArgs e)
        {
            string choice      = "VuelingFile";
            var    factory     = FactoryProvider.getFactory(choice);
            var    fileFactory = factory.Create((ComboBox.SelectedItem.ToString()));

            MessageBox.Show(fileFactory.List());
        }
Exemplo n.º 3
0
        public void DeleteTest()
        {
            IFile textFile = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.txt);

            Student newStudent = textFile.Create(student);

            Assert.IsTrue(textFile.Delete(newStudent));
        }
Exemplo n.º 4
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            Student student     = new Student(int.Parse(txtBoxStudentId.Text), txtBoxName.Text, txtBoxSurname.Text, DateTime.Parse(txtBoxBirthDate.Text));
            string  choice      = "VuelingFile";
            var     factory     = FactoryProvider.getFactory(choice);
            var     fileFactory = factory.Create((ComboBox.SelectedItem.ToString()));

            fileFactory.Update(student);
        }
Exemplo n.º 5
0
        public void AllTest()
        {
            IFile   textFile    = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.txt);
            Student newStudent  = textFile.Create(student);
            Student newStudent2 = textFile.Create(student2);

            Assert.AreEqual(newStudent.Name, textFile.All()[0].Name);
            Assert.AreEqual(newStudent2.Name, textFile.All()[1].Name);
        }
Exemplo n.º 6
0
        public void CreatesTest()
        {
            IFile textFile = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.txt);


            Student newStudent = textFile.Create(student);

            Assert.AreEqual(student, newStudent);
        }
Exemplo n.º 7
0
        private static void Commands()
        {
            Student student  = new Student(10, "Sergi", "Virgilius", 2000);
            Student student2 = new Student(11, "VIRIVIR", "asdasad", 2012);

            IFile file = FactoryProvider.getFactory(PersitenseTypes.
                                                    FILE).Create(FileTypes.txt);

            file.Delete(student2);
        }