예제 #1
0
파일: MDTest.cs 프로젝트: PravinDev/wcf
        public void cGprsTest()
        {
            var newtraceLog = new TraceLog("SingtelTest", "Zero1", null);

            using (var eventClient = new EventClient(Helpers.GetSelcommWsEndpointName()))
            {
                ServiceClient serviceclient = new ServiceClient(Helpers.GetSelcommWsEndpointName());
                ContactClient contactClient = new ContactClient(Helpers.GetSelcommWsEndpointName());

                //Create the session.
                var authService = new SelcommWSsvc.SelcommWSAll.AuthenticationClient(Helpers.GetSelcommWsEndpointName());
                var sessionKey  = authService.AuthenticateSimpleCreateSessionAndAuthenticateContact("2041591443", "webuser", "resubew", "40000287", "1234");

                //Adding a new service to an existing account
                var pack = new SelcommWSsvc.SelcommWSAll.PackagesClient(Helpers.GetSelcommWsEndpointName())
                {
                };
                var packageList = pack.PackageDisplayListCurrent(sessionKey, false);
                var newId       = serviceclient.ServiceAddNewSimple(sessionKey, "40000287", DateTime.Now, packageList[0].Code, 1, 1, "MRBR", "0298" + (new System.Random()).Next(0, 1000000).ToString("000000"), "1234");

                //creating new event associated with service Id
                Event NewEvent = new Event
                {
                    EventType = new EventType
                    {
                        EventTypeMember = "CM",
                        EventCode       = "IC",
                    },
                    Schedule = new EventSchedule
                    {
                        ToLogin      = "******",
                        ToDepartment = new Department {
                            Code = "SYS"
                        },
                        EventScheduleType = new EventScheduleType {
                            Code = "ACT"
                        },
                        EventScheduleStatus = new EventScheduleStatus {
                            Code = "O"
                        }
                    },
                    Note = string.Format("Event opened for sp_cn_ref {0}", newId)
                };


                var testevent = eventClient.EventAddForService(sessionKey, NewEvent, new Service {
                    ServiceId = newId
                });
                var eventDisplay = eventClient.EventDisplay(sessionKey, testevent, true);
                newtraceLog.CreateLog($"Global ServiceId: " + newId);
                newtraceLog.CreateLog($"Event Display: " + eventDisplay);

                SelcommWebServices.SelcommOSS.Singtel.MD.Processes.ActionHandler.cGprsActionHandler a = new SelcommWebServices.SelcommOSS.Singtel.MD.Processes.ActionHandler.cGprsActionHandler("2041591443");
                var response = a.ProcessEvent(eventDisplay, newtraceLog);
                newtraceLog.CreateLog($"Command string: " + response);
                Assert.AreEqual(response.Length, 90, "length of Command string for cGprs are equal");

                //    Assert.AreEqual(response.Length,163, "length of Command string for cGprs are equal");
            }
        }