using System; using System.Collections.Generic; using System.Linq.Expressions; using Luticate2.Auth.Utils.Business.ObjectConverterDescriptor; namespace Luticate2.Auth.Tests.Business.ObjectConverter { public static class StaticDbo { public static bool StaticField; public static bool StaticProperty { get; set; } } public class TestDbo1 { public Guid Id { get; set; } public string Name { get; set; } public IList TestDbo2s { get; set; } public string ToString() { throw new NotImplementedException(); } } public class TestDbo2 { public Guid Id { get; set; } public string Name { get; set; } public string NameVirtual { get; set; } public TestDbo1 TestDbo1 { get; set; } public TestDbo2 Parent { get; set; } public TestDbo1 Unused { get; set; } } public class TestModel1 { public Guid id { get; set; } public string name { get; set; } public ICollection test_model2 { get; set; } } public class TestModel2 { public Guid id { get; set; } public string name { get; set; } public Guid test_model1_id { get; set; } public TestModel1 test_model1 { get; set; } public TestModel2 parent { get; set; } } public class LuOcdTest1 : LuObjectConverterDescriptor { public LuOcdTest1() { AddMemberConverter(x => x.Id, y => y.id); AddMemberConverter(x => x.Name, y => y.name); AddMemberConverter(x => x.TestDbo2s, y => y.test_model2); AddStaticMethodConverter( (Expression>)(x => x.ToString()), (Expression>)(x => x.id + ": " + x.name) ); } } public class LuOcdTest2 : LuObjectConverterDescriptor { public LuOcdTest2() { AddMemberConverter(x => x.Id, y => y.id); AddMemberConverter(x => x.Name, y => y.name); AddMemberConverter(x => x.NameVirtual, y => y.name + " " + y.name); AddMemberConverter(x => x.TestDbo1, y => y.test_model1); AddMemberConverter(x => x.Parent, y => y.parent); AddMemberConverter((LambdaExpression) (Expression>) (x => x.Unused), (Expression>) (y => null)); } } }