public void GetUuid() { var service = new Part.Part() { ApplicationHeaderValue = new ApplicationHeader() { ApplicationToken = "07059250-E448-4040-B695-9C03F9E59E38", UserToken = "" } }; var cprNumbers = Properties.Resources.DPR_PNRs.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries); var start = DateTime.Now; var ret = new List <GetUuidOutputType>(); foreach (var pnr in cprNumbers) { var pnr2 = pnr.PadLeft(10, '0'); ret.Add(service.GetUuid(pnr2)); } var end = DateTime.Now; int success = ret.Where(p => !string.IsNullOrEmpty(p.UUID)).Count(); int fail = ret.Where(p => string.IsNullOrEmpty(p.UUID)).Count(); Console.WriteLine(string.Format("List <{0}> persons - Time: <{1}>, Success = <{2}>, Failed = <{3}>", cprNumbers.Length, end - start, success, fail)); }
object GetPersonFromWebService(string pnr, DateTime effectDate) { var partService = new Part.Part(); partService.ApplicationHeaderValue = new CprBroker.Tests.E_M.Part.ApplicationHeader() { ApplicationToken = ApplicationToken, UserToken = "" }; partService.Url = ServiceUrl; var uuid = partService.GetUuid(pnr); if (uuid.StandardRetur.StatusKode != "200") { throw new Exception(string.Format("GetUuid failed : {0}: {1}", uuid.StandardRetur.StatusKode, uuid.StandardRetur.FejlbeskedTekst)); } var person = partService.RefreshRead(new CprBroker.Tests.E_M.Part.LaesInputType() { UUID = uuid.UUID }); if (person.StandardRetur.StatusKode != "200") { throw new Exception(string.Format("Read failed : {0}: {1}", person.StandardRetur.StatusKode, person.StandardRetur.FejlbeskedTekst)); } return(person.LaesResultat.Item); }
public void ListRandom500() { System.Diagnostics.Debugger.Launch(); var service = new Part.Part() { ApplicationHeaderValue = new ApplicationHeader() { ApplicationToken = "07059250-E448-4040-B695-9C03F9E59E38", UserToken = "" } }; var uuids = new List <string>(Properties.Resources.All_UUIDs.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries)); Random r = new Random(); while (uuids.Count > 500) { int index = r.Next(0, uuids.Count); uuids.RemoveAt(index); } var input = new ListInputType() { UUID = uuids.ToArray() }; var start = DateTime.Now; var output = service.List(input); var end = DateTime.Now; int success = output.LaesResultat.Where(p => p.Item != null).Count(); int fail = output.LaesResultat.Where(p => p.Item == null).Count(); Console.WriteLine(string.Format("List <{0}> persons - Time: <{1}>, Success = <{2}>, Failed = <{3}>", input.UUID.Length, end - start, success, fail)); }
public static void Initialize() { // Admin AdminService = new NUnitTester.Admin.Admin(); ReplaceServiceUrl(AdminService, SystemType.CprBroker); Console.WriteLine(AdminService.Url); AdminApplicationHeader = new NUnitTester.Admin.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; AdminService.ApplicationHeaderValue = AdminApplicationHeader; // Part PartService = new CprBroker.NUnitTester.Part.Part(); ReplaceServiceUrl(PartService, SystemType.CprBroker); Console.WriteLine(PartService.Url); PartApplicationHeader = new Part.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; PartService.ApplicationHeaderValue = PartApplicationHeader; // Subscriptions SubscriptionsService = new NUnitTester.Subscriptions.Subscriptions(); ReplaceServiceUrl(SubscriptionsService, SystemType.EventBroker); Console.WriteLine(SubscriptionsService.Url); SubscriptionsApplicationHeader = new CprBroker.NUnitTester.Subscriptions.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; SubscriptionsService.ApplicationHeaderValue = SubscriptionsApplicationHeader; // Events EventsService = new CprBroker.NUnitTester.Events.Events(); ReplaceServiceUrl(EventsService, SystemType.CprBroker); Console.WriteLine(EventsService.Url); EventsApplicationHeader = new CprBroker.NUnitTester.Events.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; EventsService.ApplicationHeaderValue = EventsApplicationHeader; // Notification NotificationService = new CprBroker.NUnitTester.Notification.Notification(); ReplaceServiceUrl(NotificationService, SystemType.EventBroker); Console.WriteLine(NotificationService.Url); }
protected void Validate(Guid uuid, Part.LaesResultatType laesResultat, Part.Part service) { Assert.IsNotNull(laesResultat, "Person not found : {0}", uuid); if (laesResultat.Item is Part.RegistreringType1) { var reg = laesResultat.Item as Part.RegistreringType1; Assert.NotNull(reg.AktoerRef, "Empty actor"); Assert.AreNotEqual("", reg.AktoerRef.Item, "Empty actor text"); Assert.AreNotEqual(Guid.Empty.ToString(), reg.AktoerRef.Item, "Empty actor text"); Assert.NotNull(reg.AttributListe, "Attributes"); Assert.NotNull(reg.AttributListe.Egenskab, "AttributListe.Egenskab"); Assert.Greater(reg.AttributListe.Egenskab.Length, 0, "AttributListe.Egenskab.Length"); Assert.NotNull(reg.AttributListe.Egenskab[0].BirthDate, "Birthdate"); Assert.NotNull(reg.AttributListe.Egenskab[0].NavnStruktur, "Name"); //Assert.NotNull(reg.AttributListe.Egenskaber[0].RegisterOplysninger, "Birthdate"); Assert.NotNull(reg.AttributListe.Egenskab[0].Virkning, "Effect"); Assert.NotNull(reg.TilstandListe, "States"); Assert.NotNull(reg.RelationListe, "Relations"); } else if (laesResultat.Item is Part.FiltreretOejebliksbilledeType) { var reg = laesResultat.Item as Part.FiltreretOejebliksbilledeType; Assert.NotNull(reg.AttributListe, "Attributes"); Assert.NotNull(reg.AttributListe.Egenskab, "AttributListe.Egenskab"); Assert.Greater(reg.AttributListe.Egenskab.Length, 0, "AttributListe.Egenskab.Length"); Assert.NotNull(reg.AttributListe.Egenskab[0].BirthDate, "Birthdate"); Assert.NotNull(reg.AttributListe.Egenskab[0].NavnStruktur, "Name"); //Assert.NotNull(reg.AttributListe.Egenskaber[0].RegisterOplysninger, "Birthdate"); Assert.NotNull(reg.AttributListe.Egenskab[0].Virkning, "Effect"); Assert.NotNull(reg.TilstandListe, "States"); Assert.NotNull(reg.RelationListe, "Relations"); } else { Assert.Fail(String.Format("Unknown laesResultat object type:{0}", laesResultat.Item)); } //Assert.AreNotEqual(String.Empty, laesResultat.LaesResultat..ActorId); //Assert.IsNotNull(service.QualityHeaderValue, "Quality header"); //Assert.IsNotNull(service.QualityHeaderValue.QualityLevel, "Quality header value"); }
public void ListDPR() { var service = new Part.Part() { ApplicationHeaderValue = new ApplicationHeader() { ApplicationToken = "07059250-E448-4040-B695-9C03F9E59E38", UserToken = "" } }; var input = new ListInputType() { UUID = Properties.Resources.Successful_DPR_UUIDs.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries).Take(100).ToArray() }; //input.UUID = new string[] { "{f37779c4-358a-4c89-87e4-03a235a87f5f}" }; // "0101531538" var start = DateTime.Now; var output = service.List(input); var end = DateTime.Now; int success = output.LaesResultat.Where(p => p.Item != null).Count(); int fail = output.LaesResultat.Where(p => p.Item == null).Count(); Console.WriteLine(string.Format("List <{0}> persons - Time: <{1}>, Success = <{2}>, Failed = <{3}>", input.UUID.Length, end - start, success, fail)); }
protected void Validate(Guid uuid, Part.LaesOutputType laesOutput, Part.Part service) { Assert.IsNotNull(laesOutput, "Laes output is null{0}", uuid); Validate(laesOutput.StandardRetur); Validate(uuid, laesOutput.LaesResultat, service); }