public void GenerateClasses_ForEmptyMetadata_Should_GenerateLogicalName() { // Arrange var metadata = new EntityMetadataProxy(new EntityMetadata { LogicalName = "uber_entity" }); metadata.SetSelected(true); var values = new List <EntityMetadataProxy> { metadata }; var settings = new Settings(); var fakeWriter = A.Fake <IConstantFileWriter>(); string entity = null; var config = A.CallTo(() => fakeWriter.WriteBlock(null, null, null)) .WithAnyArguments() .Invokes((Settings s, string e, string f) => { entity = e; }); // Act GenerationUtils.GenerateFiles(values, settings, fakeWriter); // Assert config.MustHaveHappened(); Assert.IsTrue(entity.Contains("public const string EntityName = \"uber_entity\";")); }
private void LoadAttributes(EntityMetadataProxy entity) // ToDo: Deduplicate with LCG.cs { entity.Attributes = null; var retreiveMetadataChangeResponse = MetadataHelper.LoadEntityDetails(this.crmConnection.OrganizationService, entity.LogicalName); if (retreiveMetadataChangeResponse != null && retreiveMetadataChangeResponse.EntityMetadata != null && retreiveMetadataChangeResponse.EntityMetadata.Count > 0) { var entityMetadata = retreiveMetadataChangeResponse.EntityMetadata[0]; entity.Attributes = new List <AttributeMetadataProxy>( retreiveMetadataChangeResponse.EntityMetadata[0] .Attributes .Select(m => new AttributeMetadataProxy(entity, m)) .OrderBy(a => a.ToString())); } }