comparison UnitTests/Fluent/FluentConfigTest.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using BLToolkit.Data;
2 using BLToolkit.Mapping.Fluent;
3 using BLToolkit.Reflection.Extension;
4 using Microsoft.VisualStudio.TestTools.UnitTesting;
5
6 namespace BLToolkit.Fluent.Test
7 {
8 /// <summary>
9 /// Test for FluentConfig
10 /// </summary>
11 [TestClass]
12 public class FluentConfigTest
13 {
14 /// <summary>
15 /// Test configure mapping
16 /// </summary>
17 [TestMethod]
18 public void ShouldConfigMapping()
19 {
20 ExtensionList extensions = new ExtensionList();
21 FluentConfig.Configure(extensions)
22 .MapingFromAssemblyOf<FluentConfigTest>();
23
24 Assert.IsTrue(extensions.ContainsKey(typeof(Dbo1).FullName), "Not mapping");
25 Assert.IsFalse(extensions.ContainsKey(typeof(Dbo2).FullName), "Fail mapping for abstract");
26 Assert.IsFalse(extensions.ContainsKey(typeof(Dbo3).FullName), "Fail mapping for generic");
27 }
28
29 public class Dbo1
30 {
31 }
32 public class Dbo2
33 {
34 }
35 public class Dbo3
36 {
37 }
38 public class Dbo1Map : FluentMap<Dbo1>
39 {
40 public Dbo1Map()
41 {
42 TableName("t1");
43 }
44 }
45 public abstract class Dbo2Map : FluentMap<Dbo1>
46 {
47 public Dbo2Map()
48 {
49 TableName("t2");
50 }
51 }
52 public class Dbo3Map<T> : FluentMap<Dbo1>
53 {
54 public Dbo3Map()
55 {
56 TableName("t3");
57 }
58 }
59 }
60 }