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); }
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")); }
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]); }
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")); }