Example #1
0
        public void ShouldCreateNewWithInlineConfiguration()
        {
            var source = new PublicField <int> {
                Value = 20
            };

            var result = source.Map().ToANew <PublicCtorStruct <string> >(cfg => cfg
                                                                          .Map(ctx => ctx.Source.Value * 3)
                                                                          .ToCtor <string>());

            result.Value.ShouldBe("60");
        }
Example #2
0
        public void ShouldOverwriteAParsedStringValue()
        {
            var source = new PublicField <string>
            {
                Value = DateTime.Today.ToString(CultureInfo.CurrentCulture.DateTimeFormat)
            };

            var target = new PublicField <DateTime>
            {
                Value = DateTime.Today.AddDays(-1)
            };

            source.Map().Over(target);

            target.Value.ShouldBe(DateTime.Today);
        }