Ejemplo n.º 1
0
        public void Thrift_5238_ProperNullChecks()
        {
            var instance = new OptReqDefTest.RaceDetails();

            // object
            instance.Def_nested = null;
            instance.Opt_nested = null;

            // string
            instance.Req_four = null;
            instance.Def_four = null;
            instance.Opt_four = null;

            // byte[]
            instance.Req_five = null;
            instance.Def_five = null;
            instance.Opt_five = null;

            // list<>
            instance.Req_six = null;
            instance.Opt_six = null;
            instance.Def_six = null;

            // test the setup
            CheckInstance(instance);

            // validate proper null checks , any of these throws if not
            instance.ToString();
            instance.GetHashCode();

            // validate proper null checks , any of these throws if not
            var copy = instance.DeepCopy();

            CheckInstance(copy);
        }
Ejemplo n.º 2
0
        public void Thrift_5238_ProperNullChecks()
        {
            var instance = new OptReqDefTest.RaceDetails();

            // the following code INTENTIONALLY assigns null to non.nullable reftypes
            #pragma warning disable CS8625

            // object
            instance.Def_nested = null;
            instance.Opt_nested = null;

            // string
            instance.Req_four = null;
            instance.Def_four = null;
            instance.Opt_four = null;

            // byte[]
            instance.Req_five = null;
            instance.Def_five = null;
            instance.Opt_five = null;

            // list<>
            instance.Req_six = null;
            instance.Opt_six = null;
            instance.Def_six = null;

            // back to normal
            #pragma warning restore CS8625

            // test the setup
            CheckInstance(instance);

            // validate proper null checks , any of these throws if not
            instance.ToString();
            instance.GetHashCode();

            // validate proper null checks , any of these throws if not
            var copy = instance.DeepCopy();
            CheckInstance(copy);
        }