public void Flattening() { var unflat = new Foo { Name = "foo", Foo1 = new Foo { Name = "abc", Foo2 = new Foo { Foo1 = new Foo { Name = "inner" } } }, Foo2 = new Foo { Name = "123", NameZype = "aaa" }, }; var flat = new FlatFoo(); flat.InjectFrom <FlatLoopInjection>(unflat); flat.Foo2NameZype.IsEqualTo("aaa"); }
public void GenericUnflatTest() { var flat = new FlatFoo { Foo1Age = "16" }; var foo = new Foo(); foo.InjectFrom<IntToStrUnflat>(flat); foo.Foo1.Age.IsEqualTo(16); }
public void GenericFlatTest() { var foo = new Foo { Foo1 = new Foo { Age = 18 } }; var flat = new FlatFoo(); flat.InjectFrom<IntToStringFlat>(foo); flat.Foo1Age.IsEqualTo("18"); }
public void GenericUnflatTest() { var flat = new FlatFoo { Foo1Age = "16" }; var foo = new Foo(); foo.InjectFrom <IntToStrUnflat>(flat); foo.Foo1.Age.IsEqualTo(16); }
public void GenericFlatTest() { var foo = new Foo { Foo1 = new Foo { Age = 18 } }; var flat = new FlatFoo(); flat.InjectFrom <IntToStringFlat>(foo); flat.Foo1Age.IsEqualTo("18"); }
public void Unflattening() { var flat = new FlatFoo { Foo1Foo2Foo1Name = "cool", Foo1Name = "abc", Foo2Name = "123", }; var unflat = new Foo(); unflat.InjectFrom<UnflatLoopInjection>(flat); unflat.Foo1.Foo2.Foo1.Name.IsEqualTo("cool"); unflat.Foo1.Name.IsEqualTo("abc"); unflat.Foo2.Name.IsEqualTo("123"); }
public void Unflattening() { var flat = new FlatFoo { Foo1Foo2Foo1Name = "cool", Foo1Name = "abc", Foo2Name = "123", }; var unflat = new Foo(); unflat.InjectFrom <UnflatLoopInjection>(flat); unflat.Foo1.Foo2.Foo1.Name.IsEqualTo("cool"); unflat.Foo1.Name.IsEqualTo("abc"); unflat.Foo2.Name.IsEqualTo("123"); }
public void ObjectFlatTest() { var unflat = (object)new { Parent = (object)new Foo { b = true, Name = "v" } }; var flat = new FlatFoo(); flat.InjectFrom <FlatBoolToString>(unflat); flat.Parentb.IsEqualTo("True"); flat.Bool.IsEqualTo(null); }
public void Flattening() { var unflat = new Foo { Name = "foo", Foo1 = new Foo { Name = "abc", Foo2 = new Foo { Foo1 = new Foo { Name = "inner" } } }, Foo2 = new Foo { Name = "123", NameZype = "aaa" }, }; var flat = new FlatFoo(); flat.InjectFrom<FlatLoopInjection>(unflat); flat.Foo2NameZype.IsEqualTo("aaa"); }
public void GenericFlatTest() { var unflat = new Foo { Parent = new Foo { _a = "aaa", a = 23, b = true, Name = "v" } }; var flat = new FlatFoo(); flat.InjectFrom <FlatBoolToString>(unflat); flat.Parentb.IsEqualTo("True"); flat.Bool.IsEqualTo(null); }
public void FlatteningTest() { var unflat = new Foo { Parent = new Foo { _a = "aaa", a = 23, b = true, Name = "v" } }; var flat = new FlatFoo(); flat.InjectFrom <FlatLoopInjection>(unflat); flat.Parent_a.IsEqualTo(unflat.Parent._a); flat.Parenta.IsEqualTo(unflat.Parent.a); flat.Parentb.IsEqualTo(null); flat.ParentName.IsEqualTo(unflat.Parent.Name); flat.ParentParentName.IsEqualTo(null); flat.oO.IsEqualTo(null); flat.d.IsEqualTo(null); }
public void TestSimpleMappingScenarioWithSampleSourceObject() { var flatfoo = new FlatFoo { I = 1, A = DateTime.Today, B = "B" }; Foo foo = MapperFactory.GetBidirectionalMapper<Foo>(flatfoo).ToNested(flatfoo); Check.That(foo.I).IsEqualTo(1); Check.That(foo.N.A).IsEqualTo(DateTime.Today); Check.That(foo.N.B).IsEqualTo("B"); }
public void TestSimpleMappingScenarioWithProvidedProperties() { var props = new List<PropertyBasicInfo> { new PropertyBasicInfo("I", typeof (int)), new PropertyBasicInfo("A", typeof (DateTime)), new PropertyBasicInfo("B", typeof (string)) }; var flatfoo = new FlatFoo { I = 1, A = DateTime.Today, B = "B" }; Foo foo = MapperFactory.GetBidirectionalMapper<Foo>(props).ToNested(flatfoo); Check.That(foo.I).IsEqualTo(1); Check.That(foo.N.A).IsEqualTo(DateTime.Today); Check.That(foo.N.B).IsEqualTo("B"); }