Пример #1
0
        public void SingleObjectUnkownLevelBoycott ( )
        {
            var country = new Country
            {
                Name = "Serbia",
                Iso2 = "RS",
                IsoAlpha3 = "SRB",
                IsoUnM49Numerical = 688
            };

            var address = new Address
            {
                City = "Belgrade",
                Street = "Bulevar Kralja Aleksandra, 15",
                Country = country
            };

            var consignee = new Consignee
            {
                Name = "Dimitrovgrad",
                Address = address
            };

            var res = consignee.Boycott(x => x.Address.Country.Name);

            Assert.Catch<RuntimeBinderException>(
                ( ) =>
                    {
                        Console.Write(res.Address.Country.Name);
                    });
        }
Пример #2
0
        public void SingleObjectSecondLevelBoycott ( )
        {
            var country = new Country
            {
                Name = "Serbia",
                Iso2 = "RS",
                IsoAlpha3 = "SRB",
                IsoUnM49Numerical = 688
            };

            var address = new Address
            {
                City = "Belgrade",
                Street = "Bulevar Kralja Aleksandra, 15",
                Country = country
            };

            var res = address.Boycott(x => x.Country.Name);

            Assert.Throws<RuntimeBinderException>(
                ( ) =>
                    {
                        Console.Write(res.Country.Name);
                    });
        }
Пример #3
0
        public void SingleObjectUnkownLevelSanction ( )
        {
            var country = new Country
            {
                Name = "Serbia",
                Iso2 = "RS",
                IsoAlpha3 = "SRB",
                IsoUnM49Numerical = 688
            };

            var address = new Address
            {
                City = "Belgrade",
                Street = "Bulevar Kralja Aleksandra, 15",
                Country = country
            };

            var consignee = new Consignee
            {
                Name = "Dimitrovgrad",
                Address = address
            };

            var res = consignee.Sanction(x => x.Address.Country.Name);

            Assert.That(res.Address.Country.Name == consignee.Address.Country.Name);
        }
Пример #4
0
        public void SingleObjectSecondLevelSanction ( )
        {
            var country = new Country
            {
                Name = "Serbia",
                Iso2 = "RS",
                IsoAlpha3 = "SRB",
                IsoUnM49Numerical = 688
            };

            var address = new Address
            {
                City = "Belgrade",
                Street = "Bulevar Kralja Aleksandra, 15",
                Country = country
            };

            var res = address.Sanction(x => x.Country.Name, x=>x.Country.Iso2);

            Assert.That(res.Country.Name == address.Country.Name);
        }