public void NullLoggerThrowsException() { FormatterArgs item = new FormatterArgs(new FormatterArgs.CreateOptions { Logger = null }); }
private static object InvokeFormatter(FormatterArgs formatterArgs, PropertyArgs propertyArgs) { var source = Activator.CreateInstance(formatterArgs.Type); formatterArgs.Method.Invoke(source, new object[] { propertyArgs }); var formatterSource = source as Formatter; return(formatterSource.IsFormatted ? formatterSource.FormattedObject : null); }
public void CreateOptionsConstructorUpdatesProperties() { var options = new FormatterArgs.CreateOptions { State = new { }, Exception = new Exception(), DefaultValue = $"Log-{Guid.NewGuid()}", Logger = new Logger() }; FormatterArgs item = new FormatterArgs(options); Assert.AreSame(options.State, item.State); Assert.AreSame(options.Exception, item.Exception); Assert.AreEqual(options.DefaultValue, item.DefaultValue); }
private void SetParameter() { if (!IsValid()) { return; } if (_nameFormatter is SingleParameterNameFormatter) { SingleParameterNameArgs args = new SingleParameterNameArgs(int.Parse(TextItemCount)); args.IncrementValue = int.Parse(TextIncrement); args.StartValue = int.Parse(TextStartNumber); var splitTuple = GetSplitValue(); args.PrefixValue = splitTuple.Item1; args.PostfixValue = splitTuple.Item2; _args = args; } else { // TODO } }
public void SetNameFormatter(NameFormatter nameFormatter, FormatterArgs args) { _nameFormatter = nameFormatter; _args = args; }
public void NullCreateOptionsThrowsException() { FormatterArgs item = new FormatterArgs(null); }
public static Plan CreatePlan(Type type, DateTime startDate, NameFormatter nameFormatter, FormatterArgs args) { Plan plan = (Plan)Activator.CreateInstance(type, startDate); var itemNames = nameFormatter.Format(args); foreach (string itemName in itemNames) { plan.GenerateItem(itemName); } return(plan); }