Beispiel #1
0
        //Paste from here onwards:

        //public string Login(string UserId, string Password)
        //{
        //    if (string.IsNullOrEmpty(UserId) || string.IsNullOrEmpty(Password))
        //    {
        //        return "Userid or password could not be Empty.";
        //    }
        //    else {
        //        if (UserId == "Admin" && Password == "Admin")
        //        {
        //            return "Welcome Admin.";
        //        }
        //        return "Incorrect UserId or Password.";
        //    }
        //}
        //public List<EmployeeDetails> AllUsers()
        //{
        //    List<EmployeeDetails> li = new List<EmployeeDetails>();
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 100,
        //        Name = "Bharat",
        //        Geneder = "male",
        //        salary = 40000
        //    });
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 101,
        //        Name = "sunita",
        //        Geneder = "Female",
        //        salary = 50000
        //    });
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 103,
        //        Name = "Karan",
        //        Geneder = "male",
        //        salary = 40000
        //    });
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 104,
        //        Name = "Jeetu",
        //        Geneder = "male",
        //        salary = 23000
        //    });
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 105,
        //        Name = "Manasi",
        //        Geneder = "Female",
        //        salary = 80000
        //    });
        //    li.Add(new EmployeeDetails
        //    {
        //        id = 106,
        //        Name = "Ranjit",
        //        Geneder = "male",
        //        salary = 670000
        //    });
        //    return li;
        //}
        //public List<EmployeeDetails> getDetails(int id)
        //{
        //    List<EmployeeDetails> li1 = new List<EmployeeDetails>();
        //    Program p = new Program();
        //    var li = p.getUserDetails();
        //    foreach (var x in li)
        //    {
        //        if (x.id == id)
        //        {
        //            li1.Add(x);
        //        }
        //    }
        //    return li1;
        //}

        public List <clsBooks> CheckMyBooks()
        {
            //Leave this blank for right now too
            List <clsBooks> lstMyBooks = new List <clsBooks>();
            clsBooks        myBook     = new clsBooks("JK Rowling", "Kavith's Test", "69", "1.0", 1991);

            lstMyBooks.Add(myBook);
            return(lstMyBooks);
        }
Beispiel #2
0
        public void CheckMyBooks()
        {
            //Leave this blank....
            Debug.Print("this is my unit test....nothing wait");
            Program p = new Program();

            MyBooks = p.CheckMyBooks();

            clsBooks y = new clsBooks("JK Rowling", "Kavith's Test", "69", "1.0", 1991);

            foreach (var x in MyBooks)
            {
                //Assert.IsNotNull(x.Author);
                //Assert.Equals(x.Author, "JK Rowling");
                //Assert.Greater(x.CopyRightYear, 1990);
                //Assert.AreEqual(y, x);
                Assert.IsNotEmpty(x.ISBN, "Whoa!");
                //Assert.IsNotEmpty(x.Author);
                //Assert.IsNotNull(x.ISBN);
                //Assert.IsNotNull(x.Title);
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string         strTitle         = string.Empty;
            string         strAuthor        = string.Empty;
            string         strIsbn          = string.Empty;
            string         strVersion       = string.Empty;
            int            intCopyRightYear = -1; //Why is this -1?
            clsBooks       myBookToAdd      = null;
            clsBookManager myBookManager    = null;


            try
            {
                strTitle         = "Introduction to C#";
                strAuthor        = "Dinesh Kumar";
                strIsbn          = "69";
                strVersion       = "1";
                intCopyRightYear = 2018;
                myBookToAdd      = new clsBooks();
                myBookManager    = new clsBookManager();

                myBookToAdd.Author        = strAuthor.Trim();
                myBookToAdd.Title         = strTitle.Trim();
                myBookToAdd.CopyRightYear = intCopyRightYear;
                myBookToAdd.ISBN          = strIsbn.Trim();
                myBookToAdd.Version       = strVersion.Trim();

                myBookManager.AddBook(myBookToAdd); //OMG we added a book!

                //How many books do we have?
                Debug.Print(myBookManager.MyBooks.Count.ToString());
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message); //OMG What happens here?
            }
        }