예제 #1
0
파일: File.cs 프로젝트: zlzforever/AutoCSer
        internal static bool TestCase()
        {
            AutoCSer.DiskBlock.Member <Data.FieldData> fieldDataMember = default(AutoCSer.DiskBlock.Member <Data.FieldData>);
            Data.FieldData fieldData = AutoCSer.RandomObject.Creator <Data.FieldData> .Create();

            if (!fieldDataMember.Set(fieldData, 0))
            {
                return(false);
            }

            AutoCSer.DiskBlock.MemberIndex memberIndex = fieldDataMember;
            fieldDataMember = memberIndex;
            Data.FieldData newFieldData = fieldDataMember.Value.Value;
            if (newFieldData == null || !AutoCSer.FieldEquals.Comparor <Data.FieldData> .Equals(fieldData, newFieldData))
            {
                return(false);
            }

            fieldDataMember = memberIndex;
            if (!fieldDataMember.Set(fieldData, 0))
            {
                return(false);
            }
            if (!memberIndex.Equals(fieldDataMember))
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public void ReturnsItselfAmongOtherFields()
        {
            Data.FieldData   data  = GetField("class Test { int field1, field2; }");
            Data.FieldData[] other = data.GetUnderlayingFields().ToArray();

            Assert.True(other.Length == 2 && other.Any(d => d == data) && other.Any(d => d.Name == "field2"));
        }
예제 #3
0
        public void ReturnsSelf_When_HasNoOtherFieldsOnDeclaration()
        {
            Data.FieldData   data  = GetField("class Test { int field; }");
            Data.FieldData[] other = data.GetUnderlayingFields().ToArray();

            Assert.True(other.Length == 1 && data == other[0]);
        }
예제 #4
0
        public void CanReturnMultipleFields()
        {
            Data.FieldData   data  = GetField("class Test { int field1, field2; }");
            Data.FieldData[] other = data.GetUnderlayingFields().ToArray();

            Assert.True(other.Length == 2 && other.Any(d => d.Name == "field1") && other.Any(d => d.Name == "field2"));
        }