Пример #1
0
        public void register()
        {
            RegistrationControl rControl  = new RegistrationControl(libr);
            DialogResult        dlgResult = rControl.Run(form);

            if (dlgResult == DialogResult.OK)
            {
                System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string sJSON = oSerializer.Serialize(rControl.getNewPerson());
                sJSON += "\n";
                File.AppendAllText(@"E:\Registration\Registration\Registration\DataBase.json", sJSON);

                libr.Add(rControl.getNewPerson());
            }
        }
 public MainControl()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     libr = new Library();
     string sJSON;
     System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
     System.IO.StreamReader file = new System.IO.StreamReader(@"E:\Registration\Registration\Registration\DataBase.json");
     while ((sJSON = file.ReadLine()) != null)
     {
         Person nana;
         nana = JsonConvert.DeserializeObject<Person>(sJSON);
         libr.Add(nana);
     }
     file.Close();
 }
Пример #3
0
        public MainControl()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            libr = new Library();
            string sJSON;

            System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            System.IO.StreamReader file = new System.IO.StreamReader(@"E:\Registration\Registration\Registration\DataBase.json");
            while ((sJSON = file.ReadLine()) != null)
            {
                Person nana;
                nana = JsonConvert.DeserializeObject <Person>(sJSON);
                libr.Add(nana);
            }
            file.Close();
        }
Пример #4
0
 public void libraryTest2Set()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     l.Set(new Person("1", "22", "33", "44"));
     if (l.GetPassword(0) != "22")
     {
         Assert.Fail();
     }
 }
Пример #5
0
 public void libraryTest2Size()
 {
     Library l;
     l = new Library();
     if (l.Size() != 0)
     {
         Assert.Fail();
     }
     l.Add(new Person("1", "2", "3", "4"));
     if (l.Size() != 1)
     {
         Assert.Fail();
     }
 }
Пример #6
0
 public void libraryTest2GetByIndex()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     l.Add(new Person("2", "22", "33", "44"));
     if (l.GetByIndex(0).Password != "2")
     {
         Assert.Fail();
     }
 }
Пример #7
0
 public void libraryTest2GetLogin()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     l.Add(new Person("2", "22", "33", "44"));
     if (l.GetLogin(0) != "1")
     {
         Assert.Fail();
     }
 }
Пример #8
0
 public void libraryTest2Get()
 {
     Library l;
     l = new Library();
     l.Add(new Person("0", "2", "3", "4"));
     l.Add(new Person("1", "2", "3", "4"));
     l.Add(new Person("2", "2", "3", "4"));
     Person p = l.Get("1");
     if (p.Login != "1")
     {
         Assert.Fail();
     }
     if (p.Password != "2")
     {
         Assert.Fail();
     }
     if (p.Country != "3")
     {
         Assert.Fail();
     }
     if (p.Age != "4")
     {
         Assert.Fail();
     }
 }
Пример #9
0
 public void libraryTest2Find()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     if (l.Find("1") != true)
     {
         Assert.Fail();
     }
 }
Пример #10
0
 public void libraryTest2Empty()
 {
     Library l;
     l = new Library();
     if (l.Empty() != true)
     {
         Assert.Fail();
     }
     l.Add(new Person("1", "2", "3", "4"));
     if (l.Empty() != false)
     {
         Assert.Fail();
     }
 }
Пример #11
0
 public void libraryTest2Delete()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     l.Add(new Person("2", "2", "3", "4"));
     l.Add(new Person("3", "2", "3", "4"));
     l.Add(new Person("4", "2", "3", "4"));
     l.Delete("4");
     if (l.Size() != 3)
     {
         Assert.Fail();
     }
 }
Пример #12
0
 public void libraryTest2Add()
 {
     Library l;
     l = new Library();
     l.Add(new Person("1", "2", "3", "4"));
     l.Add(new Person("2", "2", "3", "4"));
     l.Add(new Person("3", "2", "3", "4"));
     if (l.Bracket[0].Login != "1")
     {
         Assert.Fail();
     }
     if (l.Bracket[0].Password != "2")
     {
         Assert.Fail();
     }
     if (l.Bracket[0].Country != "3")
     {
         Assert.Fail();
     }
     if (l.Bracket[0].Age != "4")
     {
         Assert.Fail();
     }
 }