root/UnityWeb/UnityWeb/Repository/Test/RepositoryTest/EmployeeDataProviderTest.cs
| 77 | 82 | ||
|---|---|---|---|
3 | using System; | 3 | using System; |
4 | using System.IO; | 4 | using System.IO; |
5 | using Domain.Business; | 5 | using Domain.Business; |
6 | using Microsoft.Practices.Unity; | ||
7 | using Modules.Base; | 6 | using Modules.Base; |
7 | using Modules.Unity; | ||
8 | using NUnit.Framework; | 8 | using NUnit.Framework; |
9 | using Repository.NHibernateDataAccess.Providers.Interfaces; | 9 | using Repository.NHibernateDataAccess.Providers.Interfaces; |
10 | using StructureMap; | ||
11 | using StructureMap.Attributes; | ||
10 | 12 | ||
11 | #endregion | 13 | #endregion |
12 | 14 | ||
... | ... | ||
22 | { | 24 | { |
23 | private IEmployeeDataProvider _provider; | 25 | private IEmployeeDataProvider _provider; |
24 | 26 | ||
25 | [Dependency] | 27 | [SetterProperty] |
26 | public IEmployeeDataProvider DataProvider | 28 | public IEmployeeDataProvider DataProvider |
27 | { | 29 | { |
28 | set { _provider = value; } | 30 | set { _provider = value; } |
... | ... | ||
33 | [SetUp] | 35 | [SetUp] |
34 | public void MyTestInitialize() | 36 | public void MyTestInitialize() |
35 | { | 37 | { |
36 | UnityTestContainer.Instance.BuildUp(GetType(), this); | 38 | ObjectFactory.BuildUp(this); |
37 | } | 39 | } |
38 | 40 | ||
39 | [TestFixtureSetUp] | 41 | [TestFixtureSetUp] |
... | ... | ||
43 | string configDir = Path.Combine(Environment.CurrentDirectory, relativeDir); | 45 | string configDir = Path.Combine(Environment.CurrentDirectory, relativeDir); |
44 | string testConfigDir = Path.Combine(Environment.CurrentDirectory, @"Config\"); | 46 | string testConfigDir = Path.Combine(Environment.CurrentDirectory, @"Config\"); |
45 | DeploymentItem.DeployConfigs(configDir, testConfigDir); | 47 | DeploymentItem.DeployConfigs(configDir, testConfigDir); |
48 | |||
49 | ObjectFactory.Initialize(factory => factory.AddRegistry<StructureMapRegistery>()); | ||
46 | } | 50 | } |
47 | 51 | ||
48 | #endregion | 52 | #endregion |
... | ... | ||
50 | #region Test Methods | 54 | #region Test Methods |
51 | 55 | ||
52 | [Test] | 56 | [Test] |
57 | [BusinessConversation] | ||
53 | public void AddEmployee() | 58 | public void AddEmployee() |
54 | { | 59 | { |
55 | var employee = new Employee | 60 | var employee = new Employee |
... | ... | ||
75 | } | 80 | } |
76 | 81 | ||
77 | [Test] | 82 | [Test] |
83 | [BusinessConversation] | ||
78 | public void GetEmployee() | 84 | public void GetEmployee() |
79 | { | 85 | { |
80 | const int id = 9; | 86 | const int id = 9; |
... | ... | ||
87 | } | 93 | } |
88 | 94 | ||
89 | [Test] | 95 | [Test] |
96 | [BusinessConversation] | ||
90 | public void GetEmployees() | 97 | public void GetEmployees() |
91 | { | 98 | { |
92 | var employees = _provider.GetAll(); | 99 | var employees = _provider.GetAll(); |
... | ... | ||
97 | } | 104 | } |
98 | 105 | ||
99 | [Test] | 106 | [Test] |
107 | [BusinessConversation] | ||
100 | public void GetTerritories() | 108 | public void GetTerritories() |
101 | { | 109 | { |
102 | var territories = _provider.GetTerritories(); | 110 | var territories = _provider.GetTerritories(); |
Download diff