예제 #1
0
파일: NullValuesSet.cs 프로젝트: ste93/yarp
        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);
        }
예제 #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);
        }