Esempio n. 1
0
        public void TestEmptyName()
        {
            options.Names.Clear();

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.AreEqual("1.3.6.1.4.1.33349.3.1.2.99121.283", pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);

            var names = pid.GetPatientName();

            foreach (var item in names)
            {
                Assert.IsNull(item.GivenName.Value);
                Assert.IsNull(item.FamilyLastName.FamilyName.Value);
            }
        }
Esempio n. 2
0
        public void TestNullSendingFacility()
        {
            options.Metadata.SendingFacility = null;

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.IsNull(msh.SendingFacility.NamespaceID.Value);
        }
Esempio n. 3
0
        public void TestEmptyReceivingFacility()
        {
            options.Metadata.ReceivingFacility = string.Empty;

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual(string.Empty, msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);
        }
Esempio n. 4
0
        public void TestMultipleNames()
        {
            options.Names.Add(new Name
            {
                FirstName = "Sammy",
                LastName  = "Richtofen"
            });

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

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.AreEqual("1.3.6.1.4.1.33349.3.1.2.99121.283", pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);

            var firstName = pid.GetPatientName(0);

            Assert.AreEqual("Samantha", firstName.GivenName.Value);
            Assert.AreEqual("Richtofen", firstName.FamilyLastName.FamilyName.Value);

            var secondName = pid.GetPatientName(1);

            Assert.AreEqual("Sammy", secondName.GivenName.Value);
            Assert.AreEqual("Richtofen", secondName.FamilyLastName.FamilyName.Value);

            var thirdName = pid.GetPatientName(2);

            Assert.AreEqual("Sally", thirdName.GivenName.Value);
            Assert.AreEqual("Sam", thirdName.FamilyLastName.FamilyName.Value);
        }
Esempio n. 5
0
        public void TestFullName()
        {
            options.Names.Clear();

            options.Names.Add(new Name
            {
                Prefix      = "Dr.",
                FirstName   = "Sammy",
                MiddleNames = new List <string>
                {
                    "J",
                    "Hall"
                },
                LastName = "Richtofen",
                Suffixes = new List <string>
                {
                    "MSc"
                }
            });

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.AreEqual("1.3.6.1.4.1.33349.3.1.2.99121.283", pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);

            var name = pid.GetPatientName(0);

            Assert.AreEqual("Dr.", name.PrefixEgDR.Value);
            Assert.AreEqual("Sammy", name.GivenName.Value);
            Assert.AreEqual("J Hall", name.MiddleInitialOrName.Value);
            Assert.AreEqual("Richtofen", name.FamilyLastName.FamilyName.Value);
            Assert.AreEqual("MSc", name.SuffixEgJRorIII.Value);
        }
Esempio n. 6
0
        public void TestMultipleAddresses()
        {
            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.AreEqual("1.3.6.1.4.1.33349.3.1.2.99121.283", pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);

            var firstAddress = pid.GetPatientAddress(0);

            Assert.AreEqual("Brampton", firstAddress.City.Value);
            Assert.AreEqual("Canada", firstAddress.Country.Value);
            Assert.AreEqual("Ontario", firstAddress.StateOrProvince.Value);
            Assert.AreEqual("123 Main Street West", firstAddress.StreetAddress.Value);
            Assert.AreEqual("L6X0C3", firstAddress.ZipOrPostalCode.Value);

            var secondAddress = pid.GetPatientAddress(1);

            Assert.AreEqual("New York City", secondAddress.City.Value);
            Assert.AreEqual("United States of America", secondAddress.Country.Value);
            Assert.AreEqual("New York", secondAddress.StateOrProvince.Value);
            Assert.AreEqual("250 Madison Ave.", secondAddress.StreetAddress.Value);
            Assert.AreEqual("07008", secondAddress.ZipOrPostalCode.Value);

            var thirdAddress = pid.GetPatientAddress(2);

            Assert.AreEqual("Friedberg", thirdAddress.City.Value);
            Assert.AreEqual("Germany", thirdAddress.Country.Value);
            Assert.AreEqual("Elbonia", thirdAddress.StateOrProvince.Value);
            Assert.AreEqual("Grüner Weg 6", thirdAddress.StreetAddress.Value);
            Assert.AreEqual("578233", thirdAddress.ZipOrPostalCode.Value);
        }
Esempio n. 7
0
        public void TestNullAssigningAuthority()
        {
            options.Metadata.AssigningAuthority = null;

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.IsNull(pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);
        }
Esempio n. 8
0
        public void TestEmptyDateOfBirth()
        {
            options.DateOfBirthOptions = null;

            var actual = NHapiUtility.GenerateCandidateRegistry(options);

            Assert.IsInstanceOfType(actual.GetStructure("MSH"), typeof(MSH));

            MSH msh = (MSH)actual.GetStructure("MSH");

            Assert.AreEqual("CRTEST", msh.ReceivingApplication.NamespaceID.Value);
            Assert.AreEqual("Mohawk College of Applied Arts and Technology", msh.ReceivingFacility.NamespaceID.Value);
            Assert.AreEqual("SEEDER", msh.SendingApplication.NamespaceID.Value);
            Assert.AreEqual("SEEDING", msh.SendingFacility.NamespaceID.Value);

            Assert.IsInstanceOfType(actual.GetStructure("PID"), typeof(PID));

            PID pid = (PID)actual.GetStructure("PID");

            Assert.AreEqual("1.3.6.1.4.1.33349.3.1.2.99121.283", pid.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value);
            Assert.IsNull(pid.DateTimeOfBirth.TimeOfAnEvent.Value);
        }