public void GetCustomAttributeData() { var customAttributes = new[] { CustomAttributeDeclarationObjectMother.Create() }; var field = CustomFieldInfoObjectMother.Create(customAttributes: customAttributes); var fieldInstantiation = new FieldOnTypeInstantiation(_declaringType, field); Assert.That(fieldInstantiation.GetCustomAttributeData(), Is.EqualTo(customAttributes)); }
public void Initialization() { var field = CustomFieldInfoObjectMother.Create(type: _typeParameter); var result = new FieldOnTypeInstantiation(_declaringType, field); Assert.That(result.DeclaringType, Is.SameAs(_declaringType)); Assert.That(result.Name, Is.EqualTo(field.Name)); Assert.That(result.Attributes, Is.EqualTo(field.Attributes)); Assert.That(result.FieldType, Is.SameAs(_typeArgument)); Assert.That(result.FieldOnGenericType, Is.SameAs(field)); }
public void GetSerializableFieldMapping_SameName() { FieldInfo field1 = CustomFieldInfoObjectMother.Create(name: "abc", type: typeof(int)); FieldInfo field2 = CustomFieldInfoObjectMother.Create(name: "abc", type: typeof(string)); var result = _finder.GetSerializableFieldMapping(new[] { field1, field2 }); Assert.That( result, Is.EqualTo( new[] { Tuple.Create("<tp>" + field1.DeclaringType.FullName + "::[email protected]", field1), Tuple.Create("<tp>" + field2.DeclaringType.FullName + "::[email protected]", field2) })); }