コード例 #1
0
 public IHttpActionResult Delete(int id)
 {
     var groupTeamMethods = new GroupTeamMethods();
     if (groupTeamMethods.Find(id) == null)
     {
         return BadRequest("The item doesn't exist.");
     }
     else
     {
         groupTeamMethods.Delete(id);
         return ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent));
     }
 }
コード例 #2
0
ファイル: Tests.cs プロジェクト: munirwanis/StudyProject
        public void TestDelete()
        {
            var groupTeamMethods = new GroupTeamMethods();

            var lastItemOfTheList = groupTeamMethods.Display().LastOrDefault().GroupTeamId;
            // deleto o item que quero
            groupTeamMethods.Delete(lastItemOfTheList);

            // tento encontrar o item que deletei
            var responseFind = groupTeamMethods.Find(lastItemOfTheList);

            // se for nulo, significa que o item foi apagado e o método funciona
            Assert.IsNull(responseFind);
        }
コード例 #3
0
        public IHttpActionResult Delete(int id)
        {
            var groupTeamMethods = new GroupTeamMethods();

            if (groupTeamMethods.Find(id) == null)
            {
                return(BadRequest("The item doesn't exist."));
            }
            else
            {
                groupTeamMethods.Delete(id);
                return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent)));
            }
        }
コード例 #4
0
ファイル: Tests.cs プロジェクト: munirwanis/StudyProject
        public void TestDelete()
        {
            var groupTeamMethods = new GroupTeamMethods();

            var lastItemOfTheList = groupTeamMethods.Display().LastOrDefault().GroupTeamId;

            // deleto o item que quero
            groupTeamMethods.Delete(lastItemOfTheList);

            // tento encontrar o item que deletei
            var responseFind = groupTeamMethods.Find(lastItemOfTheList);

            // se for nulo, significa que o item foi apagado e o método funciona
            Assert.IsNull(responseFind);
        }