diff UnitTests/Fluent/FluentMapAttributesTest.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UnitTests/Fluent/FluentMapAttributesTest.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,53 @@
+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);
+			}
+		}
+		
+	}
+}
\ No newline at end of file