Exemplo n.º 1
0
        public void TestPartialAddress()
        {
            options.Addresses.Clear();

            options.Addresses.Add(new Address
            {
                City          = "Chicago",
                Country       = "United States of America",
                StateProvince = "Illinois"
            });

            options.Names.Clear();

            options.Names.Add(new Name
            {
                FirstName = "Joel",
                LastName  = "Quinnville",
            });

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.AreEqual("Joel", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Given).Value);
            Assert.AreEqual("Quinnville", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Family).Value);
            Assert.IsNotNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);
            Assert.AreEqual(4, message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Count);
            Assert.AreEqual("Chicago", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.City).Value);
            Assert.AreEqual("United States of America", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.Country).Value);
            Assert.AreEqual("Illinois", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.State).Value);
        }
Exemplo n.º 2
0
        public void TestMultipleAlternateIdentifiers()
        {
            options.Names.Clear();

            options.Names.Add(new Name
            {
                FirstName = "Walter",
                LastName  = "Gretzky",
            });

            options.OtherIdentifiers.Add(new AlternateIdentifier("1.3.6.1.4.1.33349.3.1.5.100.0", "8385-171-683-CX"));
            options.OtherIdentifiers.Add(new AlternateIdentifier("1.3.6.1.4.1.33349.3.1.5.101.1", "1192-571-546-CX"));
            options.OtherIdentifiers.Add(new AlternateIdentifier("1.3.6.1.4.1.33349.3.1.5.102.2", "2115-060-045-CX"));

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.AreEqual("Walter", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Given).Value);
            Assert.AreEqual("Gretzky", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Family).Value);
            Assert.IsNotNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);
            Assert.AreEqual(7, message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Count);

            Assert.AreEqual("8385-171-683-CX", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Where(x => x.Root == "1.3.6.1.4.1.33349.3.1.5.100.0").Select(x => x.Extension).First());
            Assert.AreEqual("1192-571-546-CX", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Where(x => x.Root == "1.3.6.1.4.1.33349.3.1.5.101.1").Select(x => x.Extension).First());
            Assert.AreEqual("2115-060-045-CX", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Where(x => x.Root == "1.3.6.1.4.1.33349.3.1.5.102.2").Select(x => x.Extension).First());
        }
Exemplo n.º 3
0
        public void TestEmptyName()
        {
            options.Names.Clear();

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.AreEqual(0, message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Count);
            Assert.IsNotNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);
        }
Exemplo n.º 4
0
        public void TestGenderUndifferentiated()
        {
            options.Gender = "UN";

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.IsNotNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);

            Assert.AreEqual("undifferentiated", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.AdministrativeGenderCode.DisplayName.Value);
        }
Exemplo n.º 5
0
        public void TestEmptyDateOfBirth()
        {
            options.DateOfBirthOptions = null;
            options.Names.Clear();

            options.Names.Add(new Name
            {
                FirstName = "Strawberry",
                LastName  = "Shortcake",
            });

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.AreEqual("Strawberry", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Given).Value);
            Assert.AreEqual("Shortcake", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Family).Value);
            Assert.IsNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);
        }
Exemplo n.º 6
0
        public void TestMultipleAddresses()
        {
            options.Addresses.Clear();

            options.Addresses.Add(new Address
            {
                City          = "Chicago",
                Country       = "United States of America",
                StateProvince = "Illinois"
            });

            options.Addresses.Add(new Address
            {
                City          = "Brampton",
                Country       = "Canada",
                StreetAddress = "123 Main Street West",
                StateProvince = "Ontario"
            });

            options.Addresses.Add(new Address
            {
                City          = "New York City",
                Country       = "United States of America",
                StateProvince = "New York"
            });

            options.Addresses.Add(new Address
            {
                Country       = "Germany",
                StreetAddress = "Grüner Weg 6",
                ZipPostalCode = "578233"
            });

            options.Names.Clear();

            options.Names.Add(new Name
            {
                FirstName = "Joel",
                LastName  = "Quinnville",
            });

            var actual = EverestUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual, typeof(PRPA_IN101201CA));

            PRPA_IN101201CA message = (PRPA_IN101201CA)actual;

            Assert.AreEqual("Mohawk College of Applied Arts and Technology", message.Receiver.Device.Id.Extension);
            Assert.AreEqual("SEEDING", message.Sender.Device.Id.Extension);
            Assert.AreEqual("Joel", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Given).Value);
            Assert.AreEqual("Quinnville", message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Name.Select(x => x.Part).First().First(x => x.Type == MARC.Everest.DataTypes.EntityNamePartType.Family).Value);
            Assert.IsNotNull(message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.BirthTime.Value);
            Assert.AreEqual(4, message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.Id.Count);

            var firstAddress = message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).ElementAt(0);

            Assert.AreEqual("Chicago", firstAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.City).Value);
            Assert.AreEqual("United States of America", firstAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.Country).Value);
            Assert.AreEqual("Illinois", firstAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.State).Value);
            Assert.IsNull(firstAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.StreetAddressLine));
            Assert.IsNull(firstAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.PostalCode));

            var secondAddress = message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).ElementAt(1);

            Assert.AreEqual("Brampton", secondAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.City).Value);
            Assert.AreEqual("Canada", secondAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.Country).Value);
            Assert.AreEqual("Ontario", secondAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.State).Value);
            Assert.AreEqual("123 Main Street West", secondAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.StreetAddressLine).Value);
            Assert.IsNull(secondAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.PostalCode));

            var thirdAddress = message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).ElementAt(2);

            Assert.AreEqual("New York City", thirdAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.City).Value);
            Assert.AreEqual("United States of America", thirdAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.Country).Value);
            Assert.AreEqual("New York", thirdAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.State).Value);
            Assert.IsNull(thirdAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.StreetAddressLine));
            Assert.IsNull(thirdAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.PostalCode));

            var fourthAddress = message.controlActEvent.Subject.RegistrationRequest.Subject.registeredRole.IdentifiedPerson.Addr.Select(x => x.Part).ElementAt(3);

            Assert.IsNull(fourthAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.City));
            Assert.AreEqual("Germany", fourthAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.Country).Value);
            Assert.IsNull(fourthAddress.FirstOrDefault(x => x.Type == MARC.Everest.DataTypes.AddressPartType.State));
            Assert.AreEqual("Grüner Weg 6", fourthAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.StreetAddressLine).Value);
            Assert.AreEqual("578233", fourthAddress.First(x => x.Type == MARC.Everest.DataTypes.AddressPartType.PostalCode).Value);
        }