public void Can_generate_get_related_multi_lookup() { var lookupAttributeMetadata = new LookupAttributeMetadata { DisplayName = new Label { UserLocalizedLabel = new LocalizedLabel("User Label", 1033) }, LogicalName = "xts_lookupid", SchemaName = "Xts_SchemaLookupId", Targets = new[] { "xts_entity", "xts_anotherentity" } }; typeof(LookupAttributeMetadata).GetProperty("EntityLogicalName").SetValue(lookupAttributeMetadata, "xts_containerentity"); var lookupToEntityMetadata = new EntityMetadata { DisplayName = new Label { UserLocalizedLabel = new LocalizedLabel("Entity Label", 1033) }, LogicalName = "xts_entity", SchemaName = "EntitySchemaName" }; var holder = new LookupAttributeMetadataHolder("MyEntity", lookupAttributeMetadata, lookupToEntityMetadata); var result = holder.Generate(null); Assert.Equal("GetUserLabel", result.MethodName); Assert.Equal(ExpectedTemplate.GetRelatedMultiLookup, result.Content); }
public void Can_get_method_name_with_blacklist(LookupAttributeMetadata lookupMetadata, EntityMetadata lookupToEntityMetadata, IEnumerable <string> blacklist, string expectedName) { var holder = new LookupAttributeMetadataHolder("EntitySchemaName", lookupMetadata, lookupToEntityMetadata); Assert.Equal(expectedName, holder.GetMethodName(blacklist)); }
public void Can_get_method_name(LookupAttributeMetadata lookupMetadata, EntityMetadata lookupToEntityMetadata, string expectedName) { var holder = new LookupAttributeMetadataHolder("EntitySchemaName", lookupMetadata, lookupToEntityMetadata); Assert.Equal(expectedName, holder.GetMethodName(null)); }