コード例 #1
0
        public void GeoNames_Toponym_AlternateNamesList_ShouldSetAlternateNamesReadOnlyCollection()
        {
            var it = new Toponym
            {
                AlternateNamesList = new List <AlternateName>
                {
                    new AlternateName {
                        Name = "name 1",
                    },
                    new AlternateName {
                        Name = "name 2",
                    },
                    new AlternateName {
                        Name = "name 3",
                    },
                }
            };

            it.ShouldNotBeNull();
            it.AlternateNamesList.ShouldNotBeNull();
            it.AlternateNamesList.Count.ShouldEqual(3);
            it.AlternateNames.ShouldNotBeNull();
            it.AlternateNames.Count.ShouldEqual(it.AlternateNamesList.Count);
            for (var i = 0; i < it.AlternateNames.Count; i++)
            {
                it.AlternateNames[i].Name.ShouldEqual(it.AlternateNamesList[i].Name);
            }
        }
コード例 #2
0
        public void GeoNames_Toponym_ShouldOverrideToString()
        {
            var model = new Toponym
            {
                Name = "name",
            };

            model.ShouldNotBeNull();
            model.ToString().ShouldEqual(model.Name);
        }
コード例 #3
0
        public void GeoNames_Toponym_StringProperties_ShouldBeConvertedToNull_WhenEmptyOrWhiteSpace()
        {
            var model = new Toponym
            {
                CountryName = "   ",
                Admin1Name  = "   ",
                Admin2Name  = "   ",
                Admin3Name  = "   ",
                Admin4Name  = "   ",
            };

            model.ShouldNotBeNull();
            model.CountryName.ShouldBeNull();
            model.Admin1Name.ShouldBeNull();
            model.Admin2Name.ShouldBeNull();
            model.Admin3Name.ShouldBeNull();
            model.Admin4Name.ShouldBeNull();
        }
コード例 #4
0
        public void GeoNames_Toponym_AlternateNamesList_ShouldSetAlternateNamesReadOnlyCollection()
        {
            var it = new Toponym
            {
                AlternateNamesList = new List<AlternateName>
                {
                    new AlternateName { Name = "name 1", },
                    new AlternateName { Name = "name 2", },
                    new AlternateName { Name = "name 3", },
                }
            };

            it.ShouldNotBeNull();
            it.AlternateNamesList.ShouldNotBeNull();
            it.AlternateNamesList.Count.ShouldEqual(3);
            it.AlternateNames.ShouldNotBeNull();
            it.AlternateNames.Count.ShouldEqual(it.AlternateNamesList.Count);
            for (var i = 0; i < it.AlternateNames.Count; i++)
                it.AlternateNames[i].Name.ShouldEqual(it.AlternateNamesList[i].Name);
        }
コード例 #5
0
        public void GeoNames_Toponym_ShouldBePublic()
        {
            var model = new Toponym();

            model.ShouldNotBeNull();
        }
コード例 #6
0
        public void GeoNames_Toponym_StringProperties_ShouldBeConvertedToNull_WhenEmptyOrWhiteSpace()
        {
            var model = new Toponym
            {
                CountryName = "   ",
                Admin1Name = "   ",
                Admin2Name = "   ",
                Admin3Name = "   ",
                Admin4Name = "   ",
            };

            model.ShouldNotBeNull();
            model.CountryName.ShouldBeNull();
            model.Admin1Name.ShouldBeNull();
            model.Admin2Name.ShouldBeNull();
            model.Admin3Name.ShouldBeNull();
            model.Admin4Name.ShouldBeNull();
        }
コード例 #7
0
        public void GeoNames_Toponym_ShouldOverrideToString()
        {
            var model = new Toponym
            {
                Name = "name",
            };

            model.ShouldNotBeNull();
            model.ToString().ShouldEqual(model.Name);
        }
コード例 #8
0
        public void GeoNames_Toponym_ShouldBePublic()
        {
            var model = new Toponym();

            model.ShouldNotBeNull();
        }