Exemplo n.º 1
0
 private static void Source_initialized(SourceContext context)
 {
     var source = new ClassFiller<InputClass>().Source;
     context.Source = source;
     context.Expected = new OutputClass
                        {
                            BooleanProperty = source.BooleanProperty,
                            IntegerProperty = source.IntegerProperty,
                            StringProperty = source.StringProperty,
                            DecimalProperty = 0,
                            DateTimeProperty = source.DateTimeProperty,
                            DateTimeToNullable = source.DateTimeToNullable
                        };
     context.Destination = new OutputClass();
 }
Exemplo n.º 2
0
 private static void Map_the_property_values(SourceContext context)
 {
     var result = new MappingTester<OutputClass>().Verify(context.Destination, context.Expected);
     result.IsValid.ShouldBeTrue(result.ToString());
 }
Exemplo n.º 3
0
 private static void Map_is_called_with_properties_to_ignore(SimpleMapper simpleMapper, SourceContext context)
 {
     context.Expected.DecimalProperty = 0;
     simpleMapper.Map(context.Source, context.Destination, new Expression<Func<OutputClass, object>>[] { x => x.DecimalProperty });
 }
Exemplo n.º 4
0
 private static void Map_is_called_with_custom_conversions(SimpleMapper obj, SourceContext context)
 {
     context.Source.Map()
         .WithCustomConversion((d1, d2) => d1 == typeof(decimal) && d2 == typeof(decimal), value => (decimal)value + 1)
         .WithCustomConverter(new DateTimeToNullableDateTimeConverter())
         .WithCustomConverters(new IntToIntConverter(), new DateTimeToDateTimeConverter(), new StringToStringConverter())
         .To(context.Destination);
 }
Exemplo n.º 5
0
 private static void Inputs_configured_for_custom_conversions(SimpleMapper obj, SourceContext context)
 {
     context.Source = new ClassFiller<InputClass>().Source;
     context.Destination = new OutputClass();
     context.Expected = new OutputClass
                        {
                            BooleanProperty = context.Source.BooleanProperty,
                            DateTimeProperty = context.Source.DateTimeProperty.AddDays(-1),
                            DateTimeToNullable = context.Source.DateTimeToNullable.AddDays(1),
                            DecimalProperty = context.Source.DecimalProperty + 1,
                            IntegerProperty = context.Source.IntegerProperty + 1,
                            StringProperty = context.Source.StringProperty + "!"
                        };
 }
Exemplo n.º 6
0
 private static void Ignore_the_property_values_that_were_set_ignore(SourceContext context)
 {
     context.Destination.DecimalProperty.ShouldNotBeEqualTo(context.Source.DecimalProperty);
 }