public void TestGetAllContests()
{
using (_trans)
{
InitializeTestDBEntries();
Log("Getting pre-existing Contest count");
int contestsBefore = ContestDAO.GetActiveContests(false, false).Count;
Log("Creating contests");
Contest contest1 = new Contest()
{
Name = "Test Contest1",
Description = "This is a test contest",
Mode = ContestEndMode.GoalBased,
Type = ContestType.Group,
StartTime = DateTime.Today,
EndValue = 500,
IsActive = true,
IsSearchable = true,
StatisticBinding = Statistic.Steps,
CreatorId = _user1.UserID
};
Contest contest2 = new Contest()
{
Name = "Test Contest2",
Description = "This is also a test contest",
Mode = ContestEndMode.GoalBased,
Type = ContestType.Group,
StartTime = DateTime.Today,
EndValue = 500,
IsActive = true,
IsSearchable = true,
StatisticBinding = Statistic.BikeDistance,
CreatorId = _user1.UserID
};
Contest contest3 = new Contest()
{
Name = "Test Contest3",
Description = "This is another test contest",
Mode = ContestEndMode.GoalBased,
Type = ContestType.Group,
StartTime = DateTime.Today,
EndValue = 500,
IsActive = true,
IsSearchable = true,
StatisticBinding = Statistic.RunDistance,
CreatorId = _user1.UserID
};
Log("Adding contests to DB");
int id1 = ContestDAO.CreateNewContest(contest1);
int id2 = ContestDAO.CreateNewContest(contest2);
int id3 = ContestDAO.CreateNewContest(contest3);
Log("Verifying that GetAllContests returns three contests");
Assert.AreEqual(contestsBefore + 3, ContestDAO.GetActiveContests(false, false).Count);
}
}