示例#1
0
        public void CreateTest()
        {
            IFile   XmlFile      = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.xml);
            Student addedStudent = XmlFile.Create(student);

            Assert.AreEqual(student, addedStudent);
        }
示例#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());
        }
示例#3
0
        public void DeleteTest()
        {
            IFile textFile = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.txt);

            Student newStudent = textFile.Create(student);

            Assert.IsTrue(textFile.Delete(newStudent));
        }
示例#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);
        }
示例#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);
        }
示例#6
0
        public void CreatesTest()
        {
            IFile textFile = FactoryProvider.getFactory(PersitenseTypes.FILE).Create(FileTypes.txt);


            Student newStudent = textFile.Create(student);

            Assert.AreEqual(student, newStudent);
        }
示例#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);
        }