public void UsageDetailTestSickness() { var orgSicknesses = new UsageDetailViewModel(); var org1 = new Organisation(); org1.OrgKey = "testOrg1"; org1.Name = "testOrg1"; var orgDB = GetTestStore(); var users = GetTestUsers(org1, 10);// creates a list of users addUsersToOrgStore(users, orgDB);// adds users to orgDB addSicknessesToOrgStore(users, orgDB);// adds userNumber sicknesses to each user in orgSicknesses = UsageController.GetOrgDetailsModel(org1.OrgKey, orgDB); // for each user in org, assert that number of sickness instances = userNumber foreach (UserDetail user in orgSicknesses.UserDetail)// - can't go through each as no GetEnumerator { Assert.AreEqual(Convert.ToInt32(user.UserID), user.TotalSickness); } // argh, goign to have same problem of telling it which database to go to... }
// create users- these can be the same for each organisation public List<User> GetTestUsers(Organisation org, int number) { var users = new List<User>(); for (int i = 0; i < number; i++) { var user = new User(); string userNumber = i.ToString(); user.Id = userNumber; user.FirstName = "user" + userNumber; user.LastName = "user" + userNumber; user.OrgKey = org.OrgKey; //user.LatestHig.Value = 0; users.Add(user); } return users; }
public List<HIGEntry> GetTestHIGs(Organisation org, int number) { var HIGs = new List<HIGEntry>(); for (int i = 0; i < number; i++) { var HIG = new HIGEntry(); string HIGNumber = i.ToString(); HIG.Id = HIGNumber; HIGs.Add(HIG); } return HIGs; }
public List<Organisation> GetTestOrganisations() { var orgs = new List<Organisation>(); var org1 = new Organisation(); org1.OrgKey = "testOrg1"; org1.Name = "testOrg1"; org1.Id = "testOrg1Id"; // think these are needed to use the CreateOrgDatabase method org1.Url = "testOrg1Url"; org1.ApiKey = "testOrg1ApiKey"; orgs.Add(org1); var org2 = new Organisation(); org2.OrgKey = "testOrg2"; org2.Name = "testOrg2"; org2.Id = "testOrg2Id"; org2.Url = "testOrg2Url"; org2.ApiKey = "testOrg2ApiKey"; orgs.Add(org2); return orgs; }