Mercurial > pub > bltoolkit
view UnitTests/Fluent/FluentMapAttributesTest.cs @ 9:1e85f66cf767 default tip
update bltoolkit
author | nickolay |
---|---|
date | Thu, 05 Apr 2018 20:53:26 +0300 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System.Collections.Generic; using BLToolkit.Data; using BLToolkit.Mapping.Fluent; using BLToolkit.Mapping.MemberMappers; using BLToolkit.Reflection.Extension; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace BLToolkit.Fluent.Test { /// <summary> /// Test for FluentConfig /// </summary> [TestClass] public class FluentMapAttributesTest { /// <summary> /// Test configure mapping /// </summary> [TestMethod] 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")); } public class DboFluentMapAttributesTest { public int Id { get; set; } public List<string> Test { get; set; } } public class DboFluentMapAttributesTestMap : FluentMap<DboFluentMapAttributesTest> { public DboFluentMapAttributesTestMap() { TableName("t1"); MapField(x => x.Id).Identity(); MapField(x => x.Test).MapIgnore(false).MemberMapper(typeof(BinarySerialisationMapper)).DbType(System.Data.DbType.Binary); } } } }