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);
        }
Пример #2
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(APIBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Query, serviceImpl.Query)
            .AddMethod(__Method_VFSGetBuffer, serviceImpl.VFSGetBuffer)
            .AddMethod(__Method_WriteEvent, serviceImpl.WriteEvent).Build());
 }
Пример #3
0
        public void Statuses()
        {
            APIBase api = new APIBase();

            // Statuses
            HttpWebResponse response = api.MakeAPIRequest("GET", "application/help", "people/Statuses.help");

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.LessThanOrEqualTo(0, response.ContentLength);

            string responseString = api.GetResponseString(response);

            TestLog.WriteLine("Response: " + responseString);
            Assert.Contains(responseString, "Fellowship One RESTful API - Statuses");
        }
        public void CheckInTeacher_SignIn_TestDeleteOneCheckIn()
        {
            TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            TestLog.WriteLine("Test Delete an attendance record  ---!");
            attendenceId = "85490540";
            String url = test.CheckIn.GetCheckOutURl(attendenceId);//85490313 85490316 85490315 85490316

            TestLog.WriteLine("-deleteUrl = {0}", url);

            APIBase api            = new APIBase();
            String  responseString = api.SendAPIRequestNoAuth(url, "DELETE", HttpStatusCode.NoContent);

            TestLog.WriteLine("-deleteResponseString = {0}", responseString);
        }
Пример #5
0
        public void Google()
        {
            APIBase api = new APIBase();

            // General

            //HttpWebResponse response = api.MakeWebRequest("http://dc.apiqa.dev.corp.local/giving/v1/Accounts.help");
            WebResponse response = api.MakeWebRequest("http://dc.apiqa.dev.corp.local/giving/v1/Accounts.help");

            string responseString = api.GetResponseString((HttpWebResponse)response);

            TestLog.WriteLine("Response: " + responseString);
            //Assert.AreEqual(HttpStatusCode.OK, api.MakeAPIRequest("GET", "text/html", "Util/Docs.help").StatusCode);
            //Assert.IsNotNull(api.MakeAPIRequest("GET", "text/html", "Util/Docs.help").ContentLength);
        }
Пример #6
0
        private void Server_RequestReceived(object sender, HttpRequestEventArgs e)
        {
            APIBase b = new APIBase();

            try
            {
                b.RunMethod(e);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.StackTrace);
            }
        }
Пример #7
0
        public void General()
        {
            APIBase api = new APIBase();

            api.Realm = "giving";

            // General
            HttpWebResponse response = api.MakeAPIRequest("GET", "application/help", "Util/Docs.help");

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.LessThanOrEqualTo(0, response.ContentLength);


            string responseString = api.GetResponseString(response);

            TestLog.WriteLine("Response: " + responseString);
            Assert.Contains(responseString, "Fellowship One RESTful API - Docs");
        }
Пример #8
0
        /// <summary>
        /// Test a route that is still in development and requires authentication via SSO
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="route">The entire VERSIONED route you want to test, including query parameters like datasource and useragent. (Example: /v3/alliances/{alliance_id}/?datasource=tranquility&user_agent=EVEStandard)</param>
        /// <param name="httpMethod"></param>
        /// <param name="queryParameters"></param>
        /// <param name="auth"></param>
        /// <returns></returns>
        public async Task <string> TestDevRoute(string httpMethod, string dataSource, string route, Dictionary <string, string> queryParameters, AuthDTO auth, object body, string ifNoneMatch = null)
        {
            if (string.IsNullOrEmpty(dataSource))
            {
                throw new ArgumentException("Argument was invalid", nameof(dataSource));
            }

            var api = new APIBase(dataSource);

            APIResponse responseModel;

            switch (httpMethod.ToUpper())
            {
            case "GET":
                responseModel = await api.GetAsync(route, auth, ifNoneMatch, queryParameters);

                break;

            case "POST":
                responseModel = await api.PostAsync(route, auth, body, ifNoneMatch, queryParameters);

                break;

            case "PUT":
                responseModel = await api.PutAsync(route, auth, body, queryParameters);

                break;

            case "DELETE":
                responseModel = await api.DeleteAsync(route, auth, queryParameters);

                break;

            default:
                throw new ArgumentException("Argument was invalid", nameof(httpMethod));
            }

            if (responseModel.Error)
            {
                throw new EVEStandardException("TestDevRoute failed");
            }

            return(responseModel.JSONString);
        }
        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);
        }
Пример #10
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, APIBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_GetInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Api.Client, global::Api.Info>(serviceImpl.GetInfo));
     serviceBinder.AddMethod(__Method_Track, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod <global::Api.Request, global::Api.Update>(serviceImpl.Track));
 }
Пример #11
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(APIBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_GetInfo, serviceImpl.GetInfo)
            .AddMethod(__Method_Track, serviceImpl.Track).Build());
 }
Пример #12
0
        private void LoadAPIList(string path)
        {
            string parent = Path.GetDirectoryName(path);

            using (StreamReader sr = new StreamReader(path)) {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    bool isRequest = false;
                    {
                        int slashindex = line.IndexOf('/');
                        if (slashindex != -1)
                        {
                            switch (line.Substring(0, slashindex).ToLower())
                            {
                            case "q":
                            case "request":
                                isRequest = true;
                                goto case "s";

                            case "":
                            case "s":
                            case "response":
                                line = line.Substring(Math.Min(slashindex + 1, line.Length));
                                break;
                            }
                        }
                    }

                    if (APIObserver.Instance.APIList.ContainsKey(line))
                    {
                        APIBase api = APIObserver.Instance.APIList[line];

                        if (isRequest ? api.IsRequestSupported : api.IsResponseSupported)
                        {
                            string[] files = Directory.GetFiles(parent, string.Format("*{0}@{1}.json", isRequest ? "Q" : "S", line.Replace('/', '@')), SearchOption.TopDirectoryOnly);

                            if (files.Length == 0)
                            {
                                continue;
                            }

                            Array.Sort(files);

                            using (StreamReader sr2 = new StreamReader(files[files.Length - 1])) {
                                if (isRequest)
                                {
                                    Invoke((Action)(() => {
                                        APIObserver.Instance.LoadRequest("/kcsapi/" + line, sr2.ReadToEnd());
                                    }));
                                }
                                else
                                {
                                    Invoke((Action)(() => {
                                        APIObserver.Instance.LoadResponse("/kcsapi/" + line, sr2.ReadToEnd());
                                    }));
                                }
                            }

                            //System.Diagnostics.Debug.WriteLine( "APIList Loader: API " + line + " File " + files[files.Length-1] + " Loaded." );
                        }
                    }
                }
            }
        }
Пример #13
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, APIBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_Query, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod <global::Proto.VQLCollectorArgs, global::Proto.VQLResponse>(serviceImpl.Query));
     serviceBinder.AddMethod(__Method_VFSGetBuffer, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Proto.VFSFileBuffer, global::Proto.VFSFileBuffer>(serviceImpl.VFSGetBuffer));
     serviceBinder.AddMethod(__Method_WriteEvent, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Proto.VQLResponse, global::Google.Protobuf.WellKnownTypes.Empty>(serviceImpl.WriteEvent));
 }