/// <summary> /// Builds a collection of annotations. /// </summary> /// <param name="sut">The Subject Under Test.</param> /// <returns>The collection of annotations.</returns> private IReadOnlyCollection <ITerm> BuildAnnos(ITermFactory sut) { var annos = new ITerm[] { sut.String("Annotation") }; return(annos); }
private IStringTerm Concat(ITermFactory factory, IListTerm <IStringTerm> strs) { var sb = new StringBuilder(strs.Sum(s => s.Value.Length)); foreach (var s in strs) { sb.Append(s.Value); } return(factory.String(sb.ToString())); }
/// <summary> /// Builds a new string term. /// </summary> /// <param name="termFactory">The term factory.</param> /// <param name="value">The value of the term.</param> /// <returns>The string term.</returns> public static IStringTerm String(this ITermFactory termFactory, string value) { #region Contract if (termFactory == null) { throw new ArgumentNullException(nameof(termFactory)); } #endregion return(termFactory.String(value, Enumerable.Empty <ITerm>())); }
public IStringTerm Generate(IModuleTerm module) { return(Concat(Factory, Flatten(Factory, Factory.List( Factory.List(Factory.String( "using System;" + Environment.NewLine + Environment.NewLine + "namespace Entities" + Environment.NewLine + "{" + Environment.NewLine)), Map(Factory, module.Definitions, Generate), Factory.List(Factory.String( "}" + Environment.NewLine))) ))); }