private void GenerateEntitiesCode(List <Entity> entities, List <Relationship> relationships) { richTextBox.Clear(); Dictionary <Guid, Entity> selectedEntities = entities.ToDictionary(x => Guid.Parse(x.Guid)); Dictionary <Guid, Entity> functionalIdByentities = selectedEntities.Where(x => string.IsNullOrEmpty(x.Value.FunctionalId) == false).GroupBy(x => x.Value.FunctionalId).Select(x => x.FirstOrDefault()).ToDictionary(x => Guid.Parse(x.Value.FunctionalId), y => y.Value); T4Template.FunctionalIds = Model.FunctionalIds.FunctionalId.Where(x => functionalIdByentities.ContainsKey(Guid.Parse(x.Guid)) || x.IsDefault == true).ToList(); T4Template.Entities = entities; T4Template.Relationships = relationships; T4Template.GenerationEnvironment = null; richTextBox.Text = T4Template.TransformText(); DoStyle(); }
internal void Apply_ShouldReturnTemplateResult_WhenTransformIsOk(string content, string expected, T4Template sut) { var actual = sut.Apply(content).ValueOr(string.Empty); Check.That(actual).IsEqualTo(expected); }
internal void Apply_ShouldReturnNone_WhenTransformFailed(T4Template sut) { Check.That(sut.Apply(null).HasValue).IsFalse(); }
internal void Apply_ShouldReturnValue_WhenTransformIsOk(T4Template sut) { Check.That(sut.Apply(null).HasValue).IsTrue(); }