public void TestAdd()
 {
     rol.Add(new Person("Kanisha Brown"));
     Assert.AreEqual(rol.Count, 1);
     //Assert.AreEqual(rol.p.firstName, "Kanisha");
     //Assert.AreEqual(rol.p.lastName, "Brown");
 }
示例#2
0
        public IHttpActionResult Post([FromBody] Person p)
        {
            if (p != null)
            {
                // Make a call to CRUD Method to insert in to DB

                Roladex roladex = new Roladex();
                crud = new RolData(roladex);
                try
                {
                    crud.Populate();
                    roladex.Add(p);
                    crud.PersistDB();
                }
                catch (Exception)
                { return(BadRequest()); }
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }