Exemplo n.º 1
0
        public void Can_Delete_A_Student()
        {
            Student postData = new Student()
            {
                FirstName = "testFirstName",
                LastName  = "testLastName",
                Email     = "*****@*****.**",
                Phone     = "3939992222",
                isActive  = true
            };

            // Add a test data to DB
            _studentDbContext.Students.Add(postData);
            _studentDbContext.SaveChanges();


            endPoint = _baseUrl + "/" + postData.StudentId;


            // Delete the test data
            var result = API_Helper.DeleteRequest(endPoint, headers);

            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);

            var fromDB = _studentDbContext.Students.Where(s => s.StudentId == postData.StudentId).FirstOrDefault();

            Assert.IsNull(fromDB); //Doesn't exist in DB
        }