本文整理汇总了C#中DataAccess.SaveTeam方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.SaveTeam方法的具体用法?C# DataAccess.SaveTeam怎么用?C# DataAccess.SaveTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess.SaveTeam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Team_SelectAddSelectDeleteSelect_OK
public void Team_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
List<Team> teamsBefore = d2.GetTeams();
Team team = new Team();
team.ID = -1;
team.TeamName = "NAME00001";
team.Password = "topsecret";
team.IsAdmin = false;
team.Points = 0;
team.TeamMembers = "Joe, Jack";
Team teamafterSave = d2.SaveTeam(team);
Team teamGetByID = d2.GetTeamById(team.ID);
Team teamGetByName = d2.GetTeamByName(team.TeamName);
Assert.AreNotEqual(team.ID, -1);
Assert.AreEqual(team.TeamName, teamGetByName.TeamName);
List<Team> teamsAfterSave = d2.GetTeams();
Assert.AreEqual(team.ID, teamafterSave.ID);
Assert.AreEqual(teamsAfterSave.Count, teamsBefore.Count + 1);
d2.DeleteTeam(team.ID);
List<Team> teamsAfterDelete = d2.GetTeams();
Assert.AreEqual(teamsBefore.Count, teamsAfterDelete.Count);
}
}
示例2: TeamSubmit_SelectAddSelectDeleteSelect_OK
public void TeamSubmit_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
Team team = new Team();
team.ID = -1;
team.TeamName = "blabla";
team.TeamMembers = "asdf";
team.Password = "xxx";
team.IsAdmin = false;
d2.SaveTeam(team);
Tournament t = new Tournament();
t.Id = -1;
t.Name = "TESTING";
d2.SaveTournament(t);
Assignment a = new Assignment();
a.AssignmentId = -1;
a.AssignmentName = "ASSIGNMENT";
d2.SaveAssignment(a);
TournamentAssignment ta = new TournamentAssignment();
ta.TournamentAssignmentId = -1;
ta.TournamentId = t.Id;
ta.AssignmentId = a.AssignmentId;
ta.AssignmentOrder = 1;
ta.Points1 = 100;
ta.Points2 = 50;
ta.Points3 = 25;
ta.Active = false;
d2.SaveTournamentAssignment(ta);
TeamTournamentAssignment tta = new TeamTournamentAssignment();
tta.TeamTournamentAssignmentId = -1;
tta.TeamId = team.ID;
tta.TournamentAssignmentId = ta.TournamentAssignmentId;
d2.SaveTeamTournamentAssignment(tta);
Submit submit = new Submit();
submit.ID = -1;
submit.TeamTournamentAssignmentId = (int)tta.TeamTournamentAssignmentId;
submit.TeamId = team.ID;
byte[] uploadstream = new byte[2] {1,2};
submit.UploadStream = uploadstream;
submit.FileName = "somename.cs";
d2.InsertTeamSubmit(submit);
Assert.AreNotEqual(submit.ID, -1);
List<Submit> submits = d2.GetTeamSubmitsForAssignment(submit.TeamTournamentAssignmentId);
Assert.AreEqual(submits.Count, 1);
//getbyid
Submit byId = d2.GetTeamSubmitById(submit.ID);
Assert.AreEqual(byId.ID,submit.ID);
d2.DeleteTeamSubmit(submit.ID);
List<Submit> submitsAfterDelete = d2.GetTeamSubmitsForAssignment(submit.TeamTournamentAssignmentId);
Assert.AreEqual(0, submitsAfterDelete.Count);
}
}
示例3: TeamTournamentAssignment_SelectAddSelectDeleteSelect_OK
public void TeamTournamentAssignment_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
Team team = new Team();
team.ID = -1;
team.TeamName = "blabla";
team.TeamMembers = "asdf";
team.Password = "xxx";
team.IsAdmin=false;
d2.SaveTeam(team);
Tournament t = new Tournament();
t.Id = -1;
t.Name = "TESTING";
d2.SaveTournament(t);
Assignment a = new Assignment();
a.AssignmentId = -1;
a.AssignmentName = "ASSIGNMENT";
d2.SaveAssignment(a);
TournamentAssignment ta = new TournamentAssignment();
ta.TournamentAssignmentId = -1;
ta.TournamentId = t.Id;
ta.AssignmentId = a.AssignmentId;
ta.AssignmentOrder = 1;
ta.Points1 = 100;
ta.Points2 = 50;
ta.Points3 = 25;
ta.Active = false;
d2.SaveTournamentAssignment(ta);
List<TeamTournamentAssignment> ttaBefore = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
Assert.AreNotEqual(ttaBefore.Count, 0);
TeamTournamentAssignment tta = new TeamTournamentAssignment();
tta.TeamTournamentAssignmentId = -1;
tta.TeamId = team.ID;
tta.TournamentAssignmentId = ta.TournamentAssignmentId;
d2.SaveTeamTournamentAssignment(tta);
//id should be set
Assert.AreNotEqual(tta.TeamTournamentAssignmentId, -1);
List<TeamTournamentAssignment> ttaAfterSave = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
Assert.AreEqual(ttaAfterSave.Count, 1);
TeamTournamentAssignment ttaById = d2.GetTeamTournamentAssignmentById((int)tta.TeamTournamentAssignmentId);
Assert.AreEqual(tta.TeamId, ttaById.TeamId);
d2.DeleteTeamTournamentAssignment((int)tta.TeamTournamentAssignmentId);
List<TeamTournamentAssignment> ttaAfterDelete = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
// Assert.AreEqual(ttaAfterDelete.Count, 0);
}
}