public void MapperContext_BuildLine_Clone_Options() { var ctx = new MapperContext(null, new Snapshot(), new SnapshotOptions(), 2); var clone = ctx.Clone(2); ctx.Options.Should().BeSameAs(clone.Options); }
public void MapperContext_BuildLine_Clone_Mapper() { var ctx = new MapperContext(new DefaultMapper(), new Snapshot(), new SnapshotOptions(), 2); var clone = ctx.Clone(2); ctx.Mapper.Should().BeSameAs(clone.Mapper); }
public void MapperContext_BuildLine_Clone_Indentation() { var ctx = new MapperContext(null, new Snapshot(), new SnapshotOptions(), 2); var clone = ctx.Clone(3); ctx.Indentation.Should().Be(2); clone.Indentation.Should().Be(3); }
/// <summary> /// Map the parent object to the Snapshot /// </summary> /// <typeparam name="T"></typeparam> /// <param name="context"></param> /// <param name="item"></param> public static void Map <T>(this MapperContext context, T item) { context.Mapper.Map(context.Clone(context.Indentation), item); }
/// <summary> /// Map the object to the Snapshot /// </summary> /// <typeparam name="T"></typeparam> /// <param name="context"></param> /// <param name="property">The propertyname that the item is mapped to</param> /// <param name="item">The object to be mapped</param> public static void Map <T>(this MapperContext context, string property, T item) { context.AddLine(new Line($"{property}:".Indent(context.Indentation))); context.Mapper.Map(context.Clone(context.Indentation + 2), item); }