Exemplo n.º 1
0
        public void SharedChildren()
        {
            Adk.SifVersion = SifVersion.LATEST;
            StudentPersonal sp = new StudentPersonal(Adk.MakeGuid(), new Name(NameType.LEGAL, "hello", "world"));
            // Replace the existing demographics so there is no confusion
            Demographics d = new Demographics();

            sp.Demographics = d;
            d.SetCountryOfBirth(CountryCode.US);
            CountriesOfCitizenship countries = new CountriesOfCitizenship();

            d.CountriesOfCitizenship = countries;
            CountriesOfResidency residencies = new CountriesOfResidency();

            d.CountriesOfResidency = residencies;

            countries.AddCountryOfCitizenship(CountryCode.Wrap("UK"));
            residencies.AddCountryOfResidency(CountryCode.Wrap("AU"));

            // overwrite the country codes again, just to try to repro the issue
            d.SetCountryOfBirth(CountryCode.Wrap("AA")); // Should overwrite the existing one

            //Remove the existing CountryOfCitizenship, add three more, and remove the middle one
            Assert.IsTrue(countries.Remove(CountryCode.Wrap("UK")));
            countries.AddCountryOfCitizenship(CountryCode.Wrap("BB1"));
            countries.AddCountryOfCitizenship(CountryCode.Wrap("BB2"));
            countries.AddCountryOfCitizenship(CountryCode.Wrap("BB3"));
            Assert.IsTrue(countries.Remove(CountryCode.Wrap("BB2")));

            // Remove the existing CountryOfResidency, add three more, and remove the first one
            Assert.IsTrue(residencies.Remove(CountryCode.Wrap("AU")));
            residencies.AddCountryOfResidency(CountryCode.Wrap("CC1"));
            residencies.AddCountryOfResidency(CountryCode.Wrap("CC2"));
            residencies.AddCountryOfResidency(CountryCode.Wrap("CC3"));
            Assert.IsTrue(residencies.Remove(CountryCode.Wrap("CC1")));

            StudentPersonal sp2 = AdkObjectParseHelper.runParsingTest(sp, SifVersion.LATEST);

            // The runParsingTest() method will compare the objects after writing them and reading them
            // back in, but to be completely sure, let's assert the country codes again

            // NOTE: Due to the .Net Array.Sort algorithm, repeatable elements come out in reverse order.
            // This doesn't appear to be a problem yet, but may be fixed in a future release.
            // For now, these tests look for the elements in reverse order

            Demographics d2 = sp2.Demographics;

            Assert.AreEqual("AA", d2.CountryOfBirth.ToString(), "Country of Birth");
            Country[] citizenships = d2.CountriesOfCitizenship.ToArray();

            Assert.AreEqual(2, citizenships.Length, "Should be two CountryOfCitizenships");
            Assert.AreEqual("BB1", citizenships[0].TextValue, "First CountryOfCitizenship");
            Assert.AreEqual("BB3", citizenships[1].TextValue, "Second CountryOfCitizenship");

            // assert
            Country[] resid = d2.CountriesOfResidency.ToArray();
            Assert.AreEqual(2, resid.Length, "Should be two CountryOfResidencys");
            Assert.AreEqual("CC2", resid[0].TextValue, "First CountryOfResidencys");
            Assert.AreEqual("CC3", resid[1].TextValue, "Second CountryOfResidencys");
        }
Exemplo n.º 2
0
        public void testSettingStatePrAndCountry()
        {
            StudentPersonal sp = ObjectCreator.CreateStudentPersonal();
            Demographics    d  = sp.Demographics;

            d.SetCountryOfBirth(CountryCode.US);
            d.SetStateOfBirth(StatePrCode.AR);


            Assert.AreEqual(CountryCode.US.Value, d.CountryOfBirth);
            Assert.AreEqual(StatePrCode.AR.Value, d.StateOfBirth);
        }
Exemplo n.º 3
0
        public static StudentPersonal CreateStudentPersonal()
        {
            StudentPersonal sp = new StudentPersonal();

            AlertMessages alm = new AlertMessages();

            alm.AddAlertMessage(AlertMessageType.LEGAL, "This is the Legal Alert for Joe Student");
            sp.AlertMessages = alm;

            // TODO: Consider adding helper methods to the ADK that allow
            // list elements to be set or gotten from the parent?
            OtherIdList oidList = new OtherIdList();

            oidList.AddOtherId(OtherIdType.SIF1x_OTHER, "P00001");
            oidList.AddOtherId(OtherIdType.SIF1x_HEATH_RECORD, "WB0025");
            oidList.AddOtherId(OtherIdType.SIF1x_SSN, "123-45-6789");

            sp.OtherIdList = oidList;

            Name name = new Name(NameType.BIRTH, "Student", "Joe");

            name.MiddleName    = "";
            name.PreferredName = "Joe";
            sp.Name            = name;

            EmailList elist = new EmailList();

            elist.AddEmail(EmailType.PRIMARY, "*****@*****.**");
            sp.EmailList = elist;

            sp.OnTimeGraduationYear = 1982;
            Demographics demo = new Demographics();

            demo.BirthDate = new DateTime(1981, 12, 20);
            demo.SetCitizenshipStatus(CitizenshipStatus.USCITIZEN);

            CountriesOfCitizenship countries = new CountriesOfCitizenship();

            countries.AddCountryOfCitizenship(CountryCode.US);
            countries.AddCountryOfCitizenship(CountryCode.Wrap("CA"));
            demo.CountriesOfCitizenship = countries;
            demo.SetCountryOfBirth(CountryCode.US);

            CountriesOfResidency cre = new CountriesOfResidency(new Country(CountryCode.IE));

            demo.CountriesOfResidency = cre;

            demo.SetStateOfBirth(StatePrCode.AK);
            sp.Demographics = demo;
            Address addr = new Address();

            addr.City = "Salt Lake City";
            addr.SetStateProvince(StatePrCode.UT);
            addr.SetCountry(CountryCode.US);
            addr.PostalCode = "84102";
            Street str = new Street();

            str.Line1           = "1 IBM Plaza";
            str.ApartmentNumber = "2000";
            str.Line2           = "Suite 2000";
            str.Line3           = "Salt Lake City, UT 84102";
            str.StreetName      = "IBM";
            str.StreetNumber    = "1";
            str.StreetType      = "Plaza";
            str.ApartmentType   = "Suite";
            addr.Street         = str;
            sp.AddAddressList(PickupOrDropoff.NA, "MoTuWeThFrSaSu", addr);

            PhoneNumberList plist = new PhoneNumberList();

            plist.AddPhoneNumber(PhoneNumberType.SIF1x_HOME_PHONE, "(312) 555-1234");
            sp.PhoneNumberList = plist;

            //  Test changing the name
            sp.SetName(NameType.BIRTH, "STUDENT", "JOE");

            return(sp);
        }