public IHttpActionResult Post(GroupTeamDTO groupTeam) { var groupTeamMethods = new GroupTeamMethods(); if (groupTeam == null) { return BadRequest(); } else { groupTeamMethods.Create(groupTeam); var uri = new Uri("/api/group", UriKind.Relative); return Created(uri,"Group created with success."); } }
public IHttpActionResult Post(GroupTeamDTO groupTeam) { var groupTeamMethods = new GroupTeamMethods(); if (groupTeam == null) { return(BadRequest()); } else { groupTeamMethods.Create(groupTeam); var uri = new Uri("/api/group", UriKind.Relative); return(Created(uri, "Group created with success.")); } }
public void TestCreateGroup() { var groupTeamMethods = new GroupTeamMethods(); // crio o objeto de grupo var groupTeam = new GroupTeamDTO { Name = "Test Name", CreateDate = DateTime.Now, Description = "Testing the description" }; // vejo quantos items da tabela grupo tinham antes int totalBefore = groupTeamMethods.Display().Count; // crio no grupo passando o objeto que criei groupTeamMethods.Create(groupTeam); // vejo quantos items tem na tabela depois int totalAfter = groupTeamMethods.Display().Count; // verifico se o total antes+1 é o mesmo que o total depois // se for, significa que foi criado Assert.IsTrue((totalBefore) + 1 == totalAfter); }