public void CheckInTeacher_SignIn_CheckIn_TeacherForSchedule() { String activityName = "GraceBibleStudy"; String activityInstanceId = "33968158"; string[] rosterNameArray = { "roster1", "roster2", "roster3", "roster4", "roster072001", "roster072002", "roster072003", "roster072004", "roster072005", }; // string activityScheduleName = "scheduleeveryday"; String individualId = "30047327"; //30047327 30047329 30047330 30047331 30048834 30049458-gracechurch String checkInTime = "2015-08-13 00:50:00.000"; String individualTypeId = "2"; //student 1,teacher 2 3 4 101 TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; TestLog.WriteLine("Test Creates an attendance record ---!"); String url = test.CheckIn.GetCheckInURl(); String json = test.CheckIn.GenerateActiveCheckInJson(activityName, individualId, individualTypeId, rosterNameArray[0], activityInstanceId);// grace1:30047327 grace2:30047329 grace3: 30047330 grace4:30047331 grace5:30048834 TestLog.WriteLine("-createUrl = {0}", url); TestLog.WriteLine("-createJson = {0}", json); APIBase api = new APIBase(); String responseString = api.SendAPIRequestwithBodyNoAuth(url, "POST", json, HttpStatusCode.Created); TestLog.WriteLine("-createResponseString = {0}", responseString); Assert.Contains(responseString, "{\"id\":"); Assert.Contains(responseString, "\"url\":"); attendenceId = test.CheckIn.GetValueByStrKey(responseString, "url", "attendances/"); TestLog.WriteLine("-createAttendenceId = {0}", attendenceId); test.CheckIn.UpdateIndividual_Instance(activityName, individualId, 16729, checkInTime, activityInstanceId); }
public void CheckInTeacher_SignIn_CheckIn_Teacher() { TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; String churchCode = test.CheckIn.ChurchCode; int churchId = base.SQL.Ministry_Church_FetchID(churchCode); String timeZoneName = base.SQL.Ministry_Activity_Instance_TimeZone(churchId); DateTime currentTimzoneTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timeZoneName)); String curentDate = Convert.ToString(currentTimzoneTime.Year) + Convert.ToString(currentTimzoneTime.Month) + Convert.ToString(currentTimzoneTime.Day); int interalHour = 24 - currentTimzoneTime.Hour - 1; if (interalHour < 1) { TestLog.WriteLine("Time is not enough!"); } string ministryName = "Bible Study"; string activityName = "ActivityForCheckIn" + curentDate; TestLog.WriteLine("-activityName = {0}", activityName); String rosterNamepre = "RosterCheckIn" + curentDate; string[] rosterNameArray = { rosterNamepre + "001", rosterNamepre + "002", rosterNamepre + "003", rosterNamepre + "004", rosterNamepre + "005" }; string activityScheduleName = "ScheduleForCheckIn" + curentDate; TestLog.WriteLine("-activityScheduleName = {0}", activityScheduleName); TestLog.WriteLine("Test Creates an attendance record ---!"); String url = test.CheckIn.GetCheckInURl(); String json = test.CheckIn.GenerateActiveCheckInJson(activityName, individualId, individualTypeId, rosterNameArray[0]);// grace1:30047327 grace2:30047329 grace3: 30047330 grace4:30047331 grace5:30048834 TestLog.WriteLine("-createUrl = {0}", url); TestLog.WriteLine("-createJson = {0}", json); APIBase api = new APIBase(); String responseString = api.SendAPIRequestwithBodyNoAuth(url, "POST", json, HttpStatusCode.Created); TestLog.WriteLine("-createResponseString = {0}", responseString); Assert.Contains(responseString, "{\"id\":"); Assert.Contains(responseString, "\"url\":"); attendenceId = test.CheckIn.GetValueByStrKey(responseString, "url", "attendances/"); TestLog.WriteLine("-createAttendenceId = {0}", attendenceId); test.CheckIn.UpdateIndividual_Instance(activityName, individualId, 16729, checkInTime); }