Ejemplo n.º 1
0
        public void PersonProvider_SaveAndSearch_ShouldPass(string firstName, string lastName, string middleName, string birthDate)
        {
            var person = new Person(firstName, lastName, middleName, DateTime.Parse(birthDate));

            _personProvider.Save(ref person);
            var loadedPerson = _personProvider.Search(firstName, lastName);

            _personProvider.Remove(person);

            Assert.True(PersonsAreEqual(person, loadedPerson[0]));
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            var            person   = new Person("имя", "фамилия", "отчество", new DateTime(1666, 12, 12));
            var            provider = new PersonProvider(new DatabaseProvider());
            IList <Person> persons  = provider.Load();

            provider.Save(ref person);
            persons = provider.Load();

            person.FirstName = "Другое имя";
            provider.Update(person);
            persons = provider.Load();

            provider.Remove(person);
            persons = provider.Load();
            // String strConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
            //   SqlConnection con = new SqlConnection(strConnString);
        }