/// <summary> /// Initializes a new instance of the <see cref="TypeTransformer"/> class. /// </summary> /// <param name="transformationInstructions">The transformation map for a type.</param> /// <param name="serviceProvider">The application's serviceProvider.</param> /// <exception cref="ArgumentNullException"><paramref name="transformationInstructions"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception> public TypeTransformer( [NotNull] ITransformationInstructions transformationInstructions, [NotNull] IServiceProvider serviceProvider) { _transformationInstructions = transformationInstructions ?? throw new ArgumentNullException(nameof(transformationInstructions)); _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); }
public static void SimpleProperty_LinkAndIgnored(NonEmptyString relation) { var builder = new TransformationMap.Builder <Linker>(l => Const(l.Id)); ITransformationMap <Linker> transformationMap = builder; transformationMap.LinkAndIgnore(relation.Get, l => l.Link); ITransformationInstructions transformationInstructions = builder; Assert.Single(transformationInstructions.IgnoreInstructions); }
public static void SimpleProperty_Ignored() { var builder = new TransformationMap.Builder <Linker>(l => Const(l.Id)); ITransformationMap <Linker> transformationMap = builder; transformationMap.Ignore(l => l.Link); ITransformationInstructions transformationInstructions = builder; Assert.Single(transformationInstructions.IgnoreInstructions); }
public static void SimpleProperty_LinkAndIgnored(NonEmptyString relation) { if (relation is null) { throw new ArgumentNullException(nameof(relation)); } var builder = new TransformationMap.Builder <Linker>(l => Const(l.Id)); ITransformationMap <Linker> transformationMap = builder; _ = transformationMap.LinkAndIgnore(relation.Get, l => l.Link); ITransformationInstructions transformationInstructions = builder; _ = Assert.Single(transformationInstructions.IgnoreInstructions); }