|
1 | 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
2 | | -using System; |
3 | 2 | using Unity; |
4 | | -using Unity.Builder; |
5 | | -using Unity.Extension; |
6 | | -using Unity.Specification.Diagnostic.Issues.GitHub; |
7 | | -using Unity.Strategies; |
8 | 3 |
|
9 | | -namespace GitHub |
| 4 | +namespace Issues |
10 | 5 | { |
11 | 6 | [TestClass] |
12 | | - public class Container : Unity.Specification.Diagnostic.Issues.GitHub.SpecificationTests |
| 7 | + public class GitHub : Unity.Specification.Diagnostic.Issues.GitHub.SpecificationTests |
13 | 8 | { |
14 | 9 | public override IUnityContainer GetContainer() |
15 | 10 | { |
16 | | - return new UnityContainer().AddExtension(new ForceCompillation()) |
17 | | - .AddExtension(new Diagnostic()) |
18 | | - .AddExtension(new SpyExtension(new SpyStrategy(), UnityBuildStage.Initialization)); |
| 11 | + return new UnityContainer().AddNewExtension<Diagnostic>(); |
19 | 12 | } |
20 | 13 | } |
21 | 14 |
|
22 | | - internal class SpyExtension : UnityContainerExtension |
23 | | - { |
24 | | - private BuilderStrategy strategy; |
25 | | - private UnityBuildStage stage; |
26 | | - private object policy; |
27 | | - private Type policyType; |
28 | | - |
29 | | - public SpyExtension(BuilderStrategy strategy, UnityBuildStage stage) |
30 | | - { |
31 | | - this.strategy = strategy; |
32 | | - this.stage = stage; |
33 | | - } |
34 | | - |
35 | | - public SpyExtension(BuilderStrategy strategy, UnityBuildStage stage, object policy, Type policyType) |
36 | | - { |
37 | | - this.strategy = strategy; |
38 | | - this.stage = stage; |
39 | | - this.policy = policy; |
40 | | - this.policyType = policyType; |
41 | | - } |
42 | | - |
43 | | - protected override void Initialize() |
44 | | - { |
45 | | - Context.Strategies.Add(this.strategy, this.stage); |
46 | | - |
47 | | - if (this.policy != null) |
48 | | - { |
49 | | - Context.Policies.Set(null, null, this.policyType, this.policy); |
50 | | - } |
51 | | - } |
52 | | - } |
53 | | - |
54 | | - internal class SpyStrategy : BuilderStrategy |
55 | | - { |
56 | | - private object existing = null; |
57 | | - private bool buildUpWasCalled = false; |
58 | | - |
59 | | - public override void PreBuildUp(ref BuilderContext context) |
60 | | - { |
61 | | - this.buildUpWasCalled = true; |
62 | | - this.existing = context.Existing; |
63 | | - |
64 | | - this.UpdateSpyPolicy(ref context); |
65 | | - } |
66 | | - |
67 | | - public override void PostBuildUp(ref BuilderContext context) |
68 | | - { |
69 | | - this.existing = context.Existing; |
70 | | - } |
71 | | - |
72 | | - public object Existing |
73 | | - { |
74 | | - get { return this.existing; } |
75 | | - } |
76 | | - |
77 | | - public bool BuildUpWasCalled |
78 | | - { |
79 | | - get { return this.buildUpWasCalled; } |
80 | | - } |
81 | | - |
82 | | - private void UpdateSpyPolicy(ref BuilderContext context) |
83 | | - { |
84 | | - SpyPolicy policy = (SpyPolicy)context.Get(null, null, typeof(SpyPolicy)); |
85 | | - |
86 | | - if (policy != null) |
87 | | - { |
88 | | - policy.WasSpiedOn = true; |
89 | | - } |
90 | | - } |
91 | | - } |
92 | | - |
93 | | - internal class SpyPolicy |
| 15 | + [TestClass] |
| 16 | + public class CodePlex : Unity.Specification.Issues.Codeplex.SpecificationTests |
94 | 17 | { |
95 | | - private bool wasSpiedOn; |
96 | | - |
97 | | - public bool WasSpiedOn |
| 18 | + public override IUnityContainer GetContainer() |
98 | 19 | { |
99 | | - get { return wasSpiedOn; } |
100 | | - set { wasSpiedOn = value; } |
| 20 | + return new UnityContainer().AddNewExtension<Diagnostic>(); |
101 | 21 | } |
102 | 22 | } |
103 | 23 | } |
0 commit comments