예제 #1
0
        public void ShouldConfigMapping()
        {
            ExtensionList extensions = new ExtensionList();

            FluentConfig.Configure(extensions)
            .MapingFromAssemblyOf <FluentConfigTest>();

            Assert.IsTrue(extensions.ContainsKey(typeof(Dbo1).FullName), "Not mapping");
            Assert.IsFalse(extensions.ContainsKey(typeof(Dbo2).FullName), "Fail mapping for abstract");
            Assert.IsFalse(extensions.ContainsKey(typeof(Dbo3).FullName), "Fail mapping for generic");
        }
예제 #2
0
        public void TestFluentNullValue()
        {
            var schema = new MappingSchema();

            FluentConfig.Configure(schema).MapingFromType <TestObjectMap> ();
            var om       = schema.GetObjectMapper(typeof(TestObject));
            var instance = new TestObject()
            {
                NullableString = "SOMEVALUE"
            };

            om.SetValue(instance, "NullableString", null);
            Assert.AreEqual(null, instance.NullableString);
        }
예제 #3
0
        public void ShouldConfigMapping()
        {
            ExtensionList extensions = new ExtensionList();

            FluentConfig.Configure(extensions).MapingFromAssemblyOf <FluentMapAttributesTest>();

            var key  = extensions[typeof(DboFluentMapAttributesTest).FullName];
            var mem1 = key["Id"];

            Assert.IsTrue(mem1.Attributes.ContainsKey("Identity"));

            var mem2 = key["Test"];

            Assert.IsTrue(mem2.Attributes.ContainsKey("MemberMapper"));
            Assert.IsTrue(mem2.Attributes.ContainsKey("DbType"));
        }