public void LinqTranslations_CalculatedAttribute_DbIsOfExpressionOnBaseClass()
        {
            var a = new A()
            {
                Value = "a"
            };
            var b = new B()
            {
                Value = "b"
            };
            var c = new C()
            {
                Value = "c"
            };

            using (var connection = Effort.DbConnectionFactory.CreateTransient())
            {
                using (var context = new DemoContext(connection))
                {
                    context.As.Add(a);
                    context.Bs.Add(b);
                    context.Cs.Add(c);
                    context.SaveChanges();
                }

                using (var context = new DemoContext(connection))
                {
                    var qry = from m in context.Cs
                              orderby m.Value
                              select m.Calc;
                    var items = qry.WithTranslations().ToArray();
                    Assert.Multiple(() =>
                    {
                        Assert.AreEqual(c.Calc, items[0], "C override wrong");
                    });
                }
            }
        }
        public void LinqTranslations_CalculatedAttribute_OverrideBehaviourRuntimeType()
        {
            using (var connection = Effort.DbConnectionFactory.CreateTransient())
            {
                using (var context = new DemoContext(connection))
                {
                    SeedContext(context);
                }

                using (var context = new DemoContext(connection))
                {
                    var qry = from m in context.DemoBaseClasses
                              select new { m.ClassName,
                                           m.CalculatedAttribute };
                    qry = qry.WithTranslations();
                    foreach (var item in qry)
                    {
                        String expected;
                        switch (item.ClassName)
                        {
                        case "DemoDerivedClass1":
                        case "DemoDerivedClass2":
                            expected = "Calculated Override 1";
                            break;

                        case "DemoDerivedClass3":
                            expected = "Override 3";
                            break;

                        default:
                            expected = "TEST";
                            break;
                        }
                        Assert.AreEqual(expected, item.CalculatedAttribute, $"Incorrect calculation called for '{item.ClassName}'");
                    }
                }
            }
        }
        public void LinqTranslations_CalculatedAttribute_OverrideBehaviourRuntimeType()
        {
            var g = new G()
            {
                Value = "g"
            };
            var f = new F()
            {
                Value = "f"
            };
            var e = new E()
            {
                Value = "e"
            };
            var d = new D()
            {
                Value = "d"
            };
            var c = new C()
            {
                Value = "c"
            };
            var b = new B()
            {
                Value = "b"
            };
            var a = new A()
            {
                Value = "a"
            };

            using (var connection = Effort.DbConnectionFactory.CreateTransient())
            {
                using (var context = new DemoContext(connection))
                {
                    context.As.Add(a);
                    context.Bs.Add(b);
                    context.Cs.Add(c);
                    context.Ds.Add(d);
                    context.Es.Add(e);
                    context.Fs.Add(f);
                    context.Gs.Add(g);
                    context.SaveChanges();
                }

                using (var context = new DemoContext(connection))
                {
                    var qry = from m in context.As
                              orderby m.Value
                              select m.Calc;
                    var items = qry.WithTranslations().ToArray();
                    Assert.Multiple(() =>
                    {
                        Assert.AreEqual(a.Calc, items[0], "A override wrong");
                        Assert.AreEqual(b.Calc, items[1], "B override wrong");
                        Assert.AreEqual(c.Calc, items[2], "C override wrong");
                        Assert.AreEqual(d.Calc, items[3], "D override wrong");
                        Assert.AreEqual(e.Calc, items[4], "E override wrong");
                        Assert.AreEqual(f.Calc, items[5], "F override wrong");
                        Assert.AreEqual(g.Calc, items[6], "G override wrong");
                    });
                }
            }
        }