Exemplo n.º 1
0
        public void Test_Address1Fail()
        {
            string        text = "0 @I1@ INDI\n1 FACT\n2 ADDR Institute for Higher\n3 CONT Learning\n3 ADR1 Novozavodskaya ul., 10\n3 CITY Moskva\n3 CTRY Russia\n3 POST 121309";
            GEDCOMAddress res  = AddrParse(text);

            Assert.AreEqual("Novozavodskaya ul., 10", res.AddressLine1);
        }
Exemplo n.º 2
0
        public void Test_ResetOwner()
        {
            GEDCOMTree    newOwner = new GEDCOMTree();
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.ResetOwner(newOwner);
            Assert.AreEqual(newOwner, instance.Owner);
        }
Exemplo n.º 3
0
        public void Test_Clear()
        {
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.SetAddressText("blah");
            instance.Clear();
            Assert.IsTrue(instance.IsEmpty());
        }
Exemplo n.º 4
0
        public void Test_IsEmptyT()
        {
            GEDCOMAddress instance  = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");
            bool          expResult = true;
            bool          result    = instance.IsEmpty();

            Assert.AreEqual(expResult, result);
        }
Exemplo n.º 5
0
        public void Test_AddressParse2()
        {
            string        text = "0 @I1@ INDI\n1 FACT\n2 ADDR Institute for Higher\n3 CONT Learning\n3 CONT Novozavodskaya ul., 10\n3 CITY Moskva\n3 CTRY Russia\n3 POST 121309";
            GEDCOMAddress res  = AddrParse(text);

            string val = res.Address.Text;

            Assert.AreEqual("Institute for Higher\r\nLearning\r\nNovozavodskaya ul., 10", val);
        }
Exemplo n.º 6
0
        public void Test_SetAddressPostalCode()
        {
            string        value    = "1234A567";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressPostalCode = value;
            string result = instance.AddressPostalCode;

            Assert.AreEqual(value, result);
        }
Exemplo n.º 7
0
        public void Test_SetAddressState()
        {
            string        value    = "VORONEJSKAYA obl";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressState = value;
            string result = instance.AddressState;

            Assert.AreEqual(result, value);
        }
Exemplo n.º 8
0
        public void testIsMatch()
        {
            var              matchParams = new MatchParams();
            GEDCOMTag        other       = GEDCOMAddress.Create(null, null, "", "");
            GEDCOMNoteRecord instance    = (GEDCOMNoteRecord)GEDCOMNoteRecord.Create(null, null, "", "");
            float            expResult   = 0.0F;
            float            result      = instance.IsMatch(other, matchParams); // TODO matchParams is not used

            Assert.AreEqual(expResult, result, 0.0);
        }
Exemplo n.º 9
0
        public void testSetAddressCountry()
        {
            string        value    = "Moosylvania";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressCountry = value;
            string result = instance.AddressCountry;

            Assert.AreEqual(value, result);
        }
Exemplo n.º 10
0
        public void Test_AddressParse()
        {
            string        text = "0 @I1@ INDI\n1 FACT\n2 ADDR Institute for Higher\n3 CONT Learning\n3 ADR1 Novozavodskaya ul., 10\n3 CITY Moskva\n3 CTRY Russia\n3 POST 121309";
            GEDCOMAddress res  = AddrParse(text);

            Assert.AreEqual("Moskva", res.AddressCity);
            Assert.AreEqual("Russia", res.AddressCountry);
            Assert.AreEqual("121309", res.AddressPostalCode);
            Assert.AreEqual("", res.AddressState);
        }
Exemplo n.º 11
0
        public void Test_SetAddressCity()
        {
            string        value    = "Moskva";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressCity = value;
            string result = instance.AddressCity;

            Assert.AreEqual(value, result);
        }
Exemplo n.º 12
0
        public void Test_SetAddressLine2()
        {
            string        value    = "Novozavodskaya ul., 10";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressLine2 = value;
            string result = instance.AddressLine2;

            Assert.AreEqual(value, result);
        }
Exemplo n.º 13
0
        public void Test_SaveTagsToStream()
        {
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            StreamWriter stream = null;

            Assert.Throws(typeof(NullReferenceException), () => {
                instance.SaveToStream(stream);
            });
        }
Exemplo n.º 14
0
        public void Test_AddTag()
        {
            const string   tagName        = "BABA";
            const string   tagValue       = "YAGA";
            TagConstructor tagConstructor = null;
            GEDCOMAddress  instance       = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");
            GEDCOMTag      result         = instance.AddTag(tagName, tagValue, tagConstructor);

            Assert.IsNotNull(instance.FindTag(tagName, 0));
        }
Exemplo n.º 15
0
        public void Test_IsEmptyF()
        {
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.SetAddressText("blah");
            bool expResult = false;
            bool result    = instance.IsEmpty();

            Assert.AreEqual(expResult, result);
        }
Exemplo n.º 16
0
        public void Test_SetAddressLine1()
        {
            string        value    = "1234 Main St";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressLine1 = value;
            string result = instance.AddressLine1;

            Assert.AreEqual(value, result);
        }
Exemplo n.º 17
0
        public void Test_SetAddressLine3()
        {
            string        value    = "ALEKSCEVSKTY r-n";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddressLine3 = value;
            string result = instance.AddressLine3;

            Assert.AreEqual(result, value);
        }
Exemplo n.º 18
0
        public void Test_PhoneParse()
        {
            // TODO The standard should be the second version of the input line, but in the future we can work out the first
            //string text = "0 @I1@ INDI\n1 FACT\n2 PHON +7 499 277-71-00\n2 ADDR Institute for Higher\n3 CONT Learning\n2 PHON +7 495 967-77-76\n";
            string        text = "0 @I1@ INDI\n1 FACT\n2 ADDR Institute for Higher\n3 CONT Learning\n2 PHON +7 499 277-71-00\n2 PHON +7 495 967-77-76\n";
            GEDCOMAddress res  = AddrParse(text);

            Assert.AreEqual(2, res.PhoneNumbers.Count);

            Assert.AreEqual("Institute for Higher\r\nLearning", res.Address.Text);
        }
Exemplo n.º 19
0
        public void Test_SetAddressText()
        {
            string        value    = "this is a test";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.SetAddressText(value);
            string     res  = instance.Address.Text;
            StringList val2 = new StringList(value);

            Assert.AreEqual(val2.Text, res);
        }
Exemplo n.º 20
0
        public void Test_Assign()
        {
            GEDCOMTag     source   = null;
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            Assert.Throws(typeof(ArgumentException), () => {
                instance.Assign(source);
            });

            source = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");
            instance.Assign(source);
        }
Exemplo n.º 21
0
        public void Test_AddEmailAddress()
        {
            string        value    = "*****@*****.**";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddEmailAddress(value);
            GEDCOMList <GEDCOMTag> pl = instance.EmailAddresses;

            Assert.AreEqual(1, pl.Count);
            string res = pl.Extract(0).StringValue;

            Assert.AreEqual(res, value);
        }
Exemplo n.º 22
0
        public void Test_AddPhoneNumber()
        {
            string        value    = "(214) 748-3647";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddPhoneNumber(value);
            GEDCOMList <GEDCOMTag> pl = instance.PhoneNumbers;

            Assert.AreEqual(1, pl.Count);
            string res = pl[0].StringValue;

            Assert.AreEqual(res, value);
        }
Exemplo n.º 23
0
        public void testAddFaxNumber()
        {
            string        value    = "(214) 748-3647";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddFaxNumber(value);
            GEDCOMList <GEDCOMTag> pl = instance.FaxNumbers;

            Assert.AreEqual(1, pl.Count);
            string res = pl.Extract(0).StringValue;

            Assert.AreEqual(res, value);
        }
Exemplo n.º 24
0
        public void Test_AddWebPage1()
        {
            string        value    = "http://www.bitboost.com/ref/international-address-formats/russia/";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddWebPage(value);
            GEDCOMList <GEDCOMTag> wp = instance.WebPages;

            Assert.AreEqual(1, wp.Count);
            string res = wp.Extract(0).StringValue;

            Assert.AreEqual(res, value);
        }
Exemplo n.º 25
0
        public void Test_SetAddress()
        {
            var vals = new string[] {
                "Address Line 1",
                "Address Line 2"
            };

            StringList    value    = new StringList(vals);
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.Address = value;

            StringList result = instance.Address;

            Assert.AreEqual(value.Text, result.Text);
        }
Exemplo n.º 26
0
        public override void Assign(GEDCOMTag source)
        {
            GEDCOMAddress otherAddr = source as GEDCOMAddress;

            if (otherAddr == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "source");
            }

            base.Assign(source);

            AssignList(otherAddr.fPhoneList, fPhoneList);
            AssignList(otherAddr.fEmailList, fEmailList);
            AssignList(otherAddr.fFaxList, fFaxList);
            AssignList(otherAddr.fWWWList, fWWWList);
        }
Exemplo n.º 27
0
        public void testAddPhoneNumber2()
        {
            string        value1   = "(214) 748-3647";
            string        value2   = "(999) 748-3647";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddPhoneNumber(value1);
            instance.AddPhoneNumber(value2);
            GEDCOMList <GEDCOMTag> pl = instance.PhoneNumbers;

            Assert.AreEqual(2, pl.Count);
            string res = pl[0].StringValue;

            Assert.AreEqual(res, value1);
            res = pl[1].StringValue;
            Assert.AreEqual(res, value2);
        }
Exemplo n.º 28
0
        public void Test_SetAddressArray()
        {
            // http://www.bitboost.com/ref/international-address-formats/russia/
            string[] value = new string[] {
                "ul. Lesnaya d. 5",
                "pos. Lesnoe",
                "ALEKSCEVSKTY r-n",
                "VORONEJSKAYA obl",
                "247112",
                "RUSSIAN FEDERATION"
            };
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.SetAddressArray(value);
            string val = instance.Address.Text;

            Assert.AreEqual(new StringList(value).Text, val);
        }
Exemplo n.º 29
0
        public void Test_AddWebPage2()
        {
            string        value1   = "http://www.bitboost.com/ref/international-address-formats/russia/";
            string        value2   = "http://google.com/search";
            GEDCOMAddress instance = (GEDCOMAddress)GEDCOMAddress.Create(null, null, "", "");

            instance.AddWebPage(value1);
            instance.AddWebPage(value2);
            GEDCOMList <GEDCOMTag> wp = instance.WebPages;

            Assert.AreEqual(2, wp.Count);
            string res1 = wp[0].StringValue;

            Assert.AreEqual(res1, value1);
            string res2 = wp[1].StringValue;

            Assert.AreEqual(res2, value2);
        }