Exemple #1
0
        public void GetParentIDAccessor_ClassWithNoDetectableParentID()
        {
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.ClassWithInsufficientData), null, null);

            // FindParentIDAccessor does not throw an exception like FindIDAccessor does:
            Assert.AreEqual(0, result.Count());
        }
Exemple #2
0
        public void GetParentIDAccessor_ByAttribute()
        {
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.InvoiceLineWithAttributes), null, null);

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("Invoice_id", result.ElementAt(0));
        }
Exemple #3
0
        public void FindParentIDAccessor_ChildWithGenericNames()
        {
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.ChildWithGenericNames), null, null);

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("ParentID", result.ElementAt(0));
        }
Exemple #4
0
        public void GetParentIDAccessor_UseParentsIDToGetParentID()
        {
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.InvoiceLine), null, typeof(TestClasses.Invoice));

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("Invoice_id", result.ElementAt(0));
        }
Exemple #5
0
        public void GetParentIDAccessor_WhenPKIsJustId_Underscored()
        {
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.Glass238b), null, typeof(TestClasses.Beer238));

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("Beer238_ID", result.ElementAt(0));
        }
Exemple #6
0
        public void FindParentIDAccessor_RespectReservedWords()
        {
            // This is case in the rules, a field ending in _ParentID
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.Parent), null, typeof(TestClasses.Grandparent));

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("GrandparentID", result.ElementAt(0));
        }
Exemple #7
0
        public void FindParentIDAccessor_ChildEndingWithParentID()
        {
            // This is case in the rules, a field ending in ParentID
            var result = ChildMapperTestingHelper.FindParentIDAccessor(typeof(TestClasses.ChildEndingWithParentID), null, null);

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("MyParentID", result.ElementAt(0));
        }