Exemplo n.º 1
0
        public void TestGet()
        {
            var user = new User();

            var name = Option.Safe(() => user.GetSchool().District.Street.Name);

            Assert.IsFalse(name.ValidChain());
        }
Exemplo n.º 2
0
        public void TestGet()
        {
            var user = new User();

            var name = Option.Safe(() => user.GetSchool().District.Street.Name);

            Assert.IsFalse(name.ValidChain()); 
        }
Exemplo n.º 3
0
        public void TestNonNullWithMethods()
        {
            var user = new User
            {
                School = new School
                {
                    District = new District
                    {
                        Street = new Street
                        {
                            Name = "foo"
                        }
                    }
                }
            };

            var name = Option.Safe(() => user.GetSchool().GetDistrict().GetStreet().Name);

            Assert.AreEqual(name.Value, "foo");
        }
Exemplo n.º 4
0
        public void TestNonNullWithMethods()
        {
            var user = new User
            {
                School = new School
                         {
                             District = new District
                                        {
                                            Street = new Street
                                                     {
                                                         Name = "foo"
                                                     }
                                        }
                         }
            };

            var name = Option.Safe(() => user.GetSchool().GetDistrict().GetStreet().Name);

            Assert.AreEqual(name.Value, "foo");
        }