Skip to content
This repository
Browse code

added more fluent style interface for containers.

  • Loading branch information...
commit 958d694213d7e63f547ea79155b075948fd41e29 1 parent 8f5b7bc
authored August 02, 2012

Showing 22 changed files with 207 additions and 37 deletions. Show diff stats Hide diff stats

  1. 1  .hgignore
  2. 2  ImpromptuInterface.FSharp/AssemblyInfo.fs
  3. 4  ImpromptuInterface.MVVM/Properties/AssemblyInfo.cs
  4. 13  ImpromptuInterface.MVVM/src/IContainer.cs
  5. 23  ImpromptuInterface.MVVM/src/MEF/Container.cs
  6. 18  ImpromptuInterface.MVVM/src/Ninject/Container.cs
  7. 35  ImpromptuInterface.MVVM/src/Runtime.cs
  8. 15  ImpromptuInterface.MVVM/src/TinyIoC/Container.cs
  9. 14  ImpromptuInterface.MVVM/src/Unity/Container.cs
  10. 3  ImpromptuInterface.Silverlight/ImpromptuInterface (Silverlight).csproj
  11. 3  ImpromptuInterface.Silverlight5/ImpromptuInterface (Silverlight5).csproj
  12. 1  ImpromptuInterface/ImpromptuInterface.csproj
  13. 4  ImpromptuInterface/Properties/AssemblyInfo.cs
  14. 60  ImpromptuInterface/src/Dynamic/FluentStringLookup.cs
  15. 4  NuGetBuild/Core/ImpromptuInterface.MetaData.xml
  16. 4  NuGetBuild/FSharp/ImpromptuInterface.FSharp.MetaData.xml
  17. 4  NuGetBuild/MVVM/ImpromptuInterface.MVVM.MetaData.xml
  18. 4  Tests/UnitTestImpromptuInterface/MEFTest.cs
  19. 4  Tests/UnitTestImpromptuInterface/NinjectTest.cs
  20. 20  Tests/UnitTestImpromptuInterface/RuntimeTest.cs
  21. 4  Tests/UnitTestImpromptuInterface/TinyIoCTest.cs
  22. 4  Tests/UnitTestImpromptuInterface/UnityTest.cs
1  .hgignore
@@ -24,3 +24,4 @@ glob:nuget/symbols/*.nupkg
24 24
 glob:Thumbs.db
25 25
 syntax: glob
26 26
 packages/*
  27
+*.swp
2  ImpromptuInterface.FSharp/AssemblyInfo.fs
@@ -40,5 +40,5 @@ open System.Runtime.InteropServices;
40 40
 // You can specify all the values or you can default the Build and Revision Numbers
41 41
 // by using the ‘*’ as shown below:
42 42
 // [assembly: AssemblyVersion("1.0.*")]
43  
-[<assembly: AssemblyVersion("1.2.4.0")>]
  43
+[<assembly: AssemblyVersion("1.2.5.0")>]
44 44
 ()
4  ImpromptuInterface.MVVM/Properties/AssemblyInfo.cs
@@ -42,7 +42,7 @@
42 42
 // by using the '*' as shown below:
43 43
 // [assembly: AssemblyVersion("1.0.*")]
44 44
 #if SILVERLIGHT
45  
-[assembly: AssemblyVersion("4.0.4.0")]
  45
+[assembly: AssemblyVersion("4.0.5.0")]
46 46
 #else
47  
-[assembly: AssemblyVersion("4.0.4.*")]
  47
+[assembly: AssemblyVersion("4.0.5.*")]
48 48
 #endif
13  ImpromptuInterface.MVVM/src/IContainer.cs
@@ -46,12 +46,25 @@ public interface IContainer
46 46
         dynamic GetView(string name);
47 47
 
48 48
         /// <summary>
  49
+        /// Gets a View of the specified name View.Name()
  50
+        /// </summary>
  51
+        /// <value>The view.</value>
  52
+        dynamic View { get; }
  53
+
  54
+        /// <summary>
49 55
         /// Gets a ViewModel of the specified name
50 56
         /// </summary>
51 57
         /// <param name="name"></param>
52 58
         /// <returns></returns>
53 59
         dynamic GetViewModel(string name);
54 60
 
  61
+
  62
+        /// <summary>
  63
+        /// Gets a ViewModel of the specified name ViewModel.Name()
  64
+        /// </summary>
  65
+        /// <value>The view.</value>
  66
+        dynamic ViewModel { get; }
  67
+
55 68
         /// <summary>
56 69
         /// Gets the View for specified ViewModel
57 70
         /// </summary>
23  ImpromptuInterface.MVVM/src/MEF/Container.cs
@@ -3,6 +3,7 @@
3 3
 using System.ComponentModel.Composition.Hosting;
4 4
 using System.ComponentModel.Composition.Primitives;
5 5
 using System.Linq;
  6
+using ImpromptuInterface.Dynamic;
6 7
 
7 8
 namespace ImpromptuInterface.MVVM.MEF
8 9
 {
@@ -13,6 +14,8 @@ public sealed class Container : IContainer
13 14
     {
14 15
         private readonly CompositionContainer _container;
15 16
         private readonly Dictionary<Type, string> _viewLookup = new Dictionary<Type, string>();
  17
+        private readonly FluentStringLookup _viewStringLookup;
  18
+        private readonly FluentStringLookup _viewModelStringLookup;
16 19
 
17 20
         /// <summary>
18 21
         /// Default ctor, requires a MEF CompositionContainer
@@ -21,6 +24,8 @@ public sealed class Container : IContainer
21 24
         public Container(CompositionContainer container)
22 25
         {
23 26
             _container = container;
  27
+            _viewStringLookup = new FluentStringLookup(GetView);
  28
+            _viewModelStringLookup = new FluentStringLookup(GetViewModel);
24 29
         }
25 30
 
26 31
         /// <summary>
@@ -76,6 +81,15 @@ public dynamic GetView(string name)
76 81
         }
77 82
 
78 83
         /// <summary>
  84
+        /// Gets a View of the specified name View.Name()
  85
+        /// </summary>
  86
+        /// <value>The view.</value>
  87
+        public dynamic View
  88
+        {
  89
+            get { return _viewStringLookup; }
  90
+        }
  91
+
  92
+        /// <summary>
79 93
         /// Gets a ViewModel of the specified name
80 94
         /// </summary>
81 95
         /// <param name="name"></param>
@@ -86,6 +100,15 @@ public dynamic GetViewModel(string name)
86 100
         }
87 101
 
88 102
         /// <summary>
  103
+        /// Gets a ViewModel of the specified name ViewModel.Name()
  104
+        /// </summary>
  105
+        /// <value>The view.</value>
  106
+        public dynamic ViewModel
  107
+        {
  108
+            get { return _viewModelStringLookup; }
  109
+        }
  110
+
  111
+        /// <summary>
89 112
         /// Gets the View for specified ViewModel
90 113
         /// </summary>
91 114
         /// <param name="viewModel"></param>
18  ImpromptuInterface.MVVM/src/Ninject/Container.cs
@@ -16,6 +16,8 @@ public sealed class Container : IContainer
16 16
         private string[] _fullyQualifiedTypes;
17 17
         private InvokeContext _staticContext;
18 18
         private dynamic _resolutionExtensions;
  19
+        private readonly FluentStringLookup _viewStringlookup;
  20
+        private readonly FluentStringLookup _viewModelStringLookup;
19 21
 
20 22
         /// <summary>
21 23
         /// Constructor, taking in an IKernel
@@ -27,6 +29,9 @@ public Container(dynamic kernel, Type kernelInterface)
27 29
             _kernel = kernel;
28 30
             _kernelInterface = kernelInterface;
29 31
 
  32
+            _viewStringlookup = new FluentStringLookup(GetView);
  33
+            _viewModelStringLookup = new FluentStringLookup(GetViewModel);
  34
+
30 35
 #if SILVERLIGHT
31 36
             var assembly = Assembly.GetCallingAssembly();
32 37
 #else
@@ -48,6 +53,9 @@ public Container(dynamic kernel,Type kernelInterface,  params Assembly[] assembl
48 53
             _kernel = kernel;
49 54
             _kernelInterface = kernelInterface;
50 55
 
  56
+            _viewStringlookup = new FluentStringLookup(GetView);
  57
+            _viewModelStringLookup = new FluentStringLookup(GetViewModel);
  58
+
51 59
             LateBind();
52 60
             ReflectNamespaces(assemblies);
53 61
         }
@@ -104,6 +112,11 @@ public dynamic GetView(string name)
104 112
             return _resolutionExtensions.Get(_kernel, FindType(name + "View"));
105 113
         }
106 114
 
  115
+        public dynamic View
  116
+        {
  117
+            get { return _viewStringlookup; }
  118
+        }
  119
+
107 120
         /// <summary>
108 121
         /// Gets a ViewModel of the specified name
109 122
         /// </summary>
@@ -114,6 +127,11 @@ public dynamic GetViewModel(string name)
114 127
             return _resolutionExtensions.Get(_kernel, FindType(name + "ViewModel"));
115 128
         }
116 129
 
  130
+        public dynamic ViewModel
  131
+        {
  132
+            get { return _viewModelStringLookup; }
  133
+        }
  134
+
117 135
         /// <summary>
118 136
         /// Gets the View for specified ViewModel
119 137
         /// </summary>
35  ImpromptuInterface.MVVM/src/Runtime.cs
@@ -4,6 +4,7 @@
4 4
 using System.Text;
5 5
 using System.ComponentModel.Composition.Hosting;
6 6
 using System.Reflection;
  7
+using ImpromptuInterface.Dynamic;
7 8
 
8 9
 namespace ImpromptuInterface.MVVM
9 10
 {
@@ -20,9 +21,12 @@ public sealed class Runtime
20 21
             { "Ninject.IKernel", (c, a, t) => new Ninject.Container(c, t, a) },
21 22
         };
22 23
         private Assembly _callingAssembly = null;
  24
+        private FluentStringLookup _startLookup;
23 25
 
24 26
         private Runtime()
25  
-        { }
  27
+        {
  28
+            _startLookup = new FluentStringLookup(StartView);
  29
+        }
26 30
 
27 31
         /// <summary>
28 32
         /// Gets the "Main" view of the application, the one invoked from Runtime.Start()
@@ -33,6 +37,8 @@ public static dynamic MainView
33 37
             private set;
34 38
         }
35 39
 
  40
+
  41
+
36 42
         /// <summary>
37 43
         /// Creates an instance of Runtime
38 44
         /// </summary>
@@ -92,13 +98,26 @@ public Runtime SetupContainer(dynamic container)
92 98
             return this;
93 99
         }
94 100
 
  101
+
  102
+        /// <summary>
  103
+        /// Starts the runtime by opening the specified View (Window) Start.Main();
  104
+        /// </summary>
  105
+        /// <returns></returns>
  106
+        public dynamic Start
  107
+        {
  108
+            get
  109
+            {
  110
+                return _startLookup;
  111
+            }
  112
+        }
  113
+
95 114
 #if SILVERLIGHT
96 115
         /// <summary>
97 116
         /// Starts the runtime by setting the specified View to Application.Current.RootVisual
98 117
         /// </summary>
99 118
         /// <param name="name"></param>
100 119
         /// <returns></returns>
101  
-        public Runtime Start(string name)
  120
+        private Runtime StartView(string name)
102 121
         {
103 122
             if (!IoC.Initialized)
104 123
             {
@@ -110,12 +129,12 @@ public Runtime Start(string name)
110 129
             return this;
111 130
         }
112 131
 #else
113  
-        /// <summary>
114  
-        /// Starts the runtime by opening the specified View (Window)
115  
-        /// </summary>
116  
-        /// <param name="name"></param>
117  
-        /// <returns></returns>
118  
-        public Runtime Start(string name)
  132
+
  133
+   
  134
+
  135
+
  136
+       
  137
+        private Runtime StartView(string name)
119 138
         {
120 139
             if (!IoC.Initialized)
121 140
             {
15  ImpromptuInterface.MVVM/src/TinyIoC/Container.cs
... ...
@@ -1,5 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
  3
+using ImpromptuInterface.Dynamic;
3 4
 
4 5
 namespace ImpromptuInterface.MVVM.TinyIoC
5 6
 {
@@ -10,6 +11,8 @@ public sealed class Container : IContainer
10 11
     {
11 12
         private readonly dynamic _container;
12 13
         private readonly Dictionary<Type, string> _viewLookup = new Dictionary<Type, string>();
  14
+        private readonly FluentStringLookup _viewStringLookup;
  15
+        private readonly FluentStringLookup _viewModelStringLookup;
13 16
 
14 17
         /// <summary>
15 18
         /// Default ctor, requires a TinyIoCContainer
@@ -18,6 +21,8 @@ public sealed class Container : IContainer
18 21
         public Container(dynamic container)
19 22
         {
20 23
             _container = container;
  24
+            _viewStringLookup = new FluentStringLookup(GetView);
  25
+            _viewModelStringLookup = new FluentStringLookup(GetViewModel);
21 26
         }
22 27
 
23 28
         /// <summary>
@@ -73,6 +78,11 @@ public dynamic GetView(string name)
73 78
             return Get(name + IoC.View);
74 79
         }
75 80
 
  81
+        public dynamic View
  82
+        {
  83
+            get { return _viewStringLookup; }
  84
+        }
  85
+
76 86
         /// <summary>
77 87
         /// Gets a ViewModel of the specified name
78 88
         /// </summary>
@@ -83,6 +93,11 @@ public dynamic GetViewModel(string name)
83 93
             return Get(name + IoC.ViewModel);
84 94
         }
85 95
 
  96
+        public dynamic ViewModel
  97
+        {
  98
+            get { return _viewModelStringLookup; }
  99
+        }
  100
+
86 101
         /// <summary>
87 102
         /// Gets the View for specified ViewModel
88 103
         /// </summary>
14  ImpromptuInterface.MVVM/src/Unity/Container.cs
@@ -16,6 +16,8 @@ public class Container : IContainer
16 16
         private readonly Dictionary<Type, string> _viewLookup = new Dictionary<Type, string>();
17 17
         private InvokeContext _staticContext;
18 18
         private dynamic _unityContainerExtensions;
  19
+        private readonly FluentStringLookup _viewStringLookup;
  20
+        private FluentStringLookup _viewModelStringLookup;
19 21
 
20 22
         /// <summary>
21 23
         /// Default ctor, requires an IUnityContainer
@@ -26,6 +28,8 @@ public Container(dynamic container, Type containerInterface)
26 28
         {
27 29
             _container = container;
28 30
             _containerInterface = containerInterface;
  31
+            _viewStringLookup = new FluentStringLookup(GetView);
  32
+            _viewModelStringLookup = new FluentStringLookup(GetViewModel);
29 33
             LateBind();
30 34
         }
31 35
 
@@ -87,6 +91,11 @@ public dynamic GetView(string name)
87 91
             return Get(name + IoC.View);
88 92
         }
89 93
 
  94
+        public dynamic View
  95
+        {
  96
+            get { return _viewStringLookup; }
  97
+        }
  98
+
90 99
         /// <summary>
91 100
         /// Gets a ViewModel of the specified name
92 101
         /// </summary>
@@ -97,6 +106,11 @@ public dynamic GetViewModel(string name)
97 106
             return Get(name + IoC.ViewModel);
98 107
         }
99 108
 
  109
+        public dynamic ViewModel
  110
+        {
  111
+            get { return _viewModelStringLookup; }
  112
+        }
  113
+
100 114
         /// <summary>
101 115
         /// Gets the View for specified ViewModel
102 116
         /// </summary>
3  ImpromptuInterface.Silverlight/ImpromptuInterface (Silverlight).csproj
@@ -103,6 +103,9 @@
103 103
     <Compile Include="..\ImpromptuInterface\src\Dynamic\FluentRegex.cs">
104 104
       <Link>src\Dynamic\FluentRegex.cs</Link>
105 105
     </Compile>
  106
+    <Compile Include="..\ImpromptuInterface\src\Dynamic\FluentStringLookup.cs">
  107
+      <Link>src\Dynamic\FluentStringLookup.cs</Link>
  108
+    </Compile>
106 109
     <Compile Include="..\ImpromptuInterface\src\Dynamic\IActLike.cs">
107 110
       <Link>src\Dynamic\IActLike.cs</Link>
108 111
     </Compile>
3  ImpromptuInterface.Silverlight5/ImpromptuInterface (Silverlight5).csproj
@@ -83,6 +83,9 @@
83 83
     <Compile Include="..\ImpromptuInterface\src\Dynamic\FluentRegex.cs">
84 84
       <Link>src\Dynamic\FluentRegex.cs</Link>
85 85
     </Compile>
  86
+    <Compile Include="..\ImpromptuInterface\src\Dynamic\FluentStringLookup.cs">
  87
+      <Link>src\Dynamic\FluentStringLookup.cs</Link>
  88
+    </Compile>
86 89
     <Compile Include="..\ImpromptuInterface\src\Dynamic\IActLike.cs">
87 90
       <Link>src\Dynamic\IActLike.cs</Link>
88 91
     </Compile>
1  ImpromptuInterface/ImpromptuInterface.csproj
@@ -109,6 +109,7 @@
109 109
   <ItemGroup>
110 110
     <Compile Include="Properties\AssemblyInfo.cs" />
111 111
     <Compile Include="src\ActLikeCaster.cs" />
  112
+    <Compile Include="src\Dynamic\FluentStringLookup.cs" />
112 113
     <Compile Include="src\Dynamic\ImpromptuMatch.cs" />
113 114
     <Compile Include="src\Dynamic\FluentRegex.cs" />
114 115
     <Compile Include="src\Dynamic\Mimic.cs" />
4  ImpromptuInterface/Properties/AssemblyInfo.cs
@@ -59,10 +59,10 @@
59 59
 
60 60
 #if SILVERLIGHT
61 61
 
62  
-[assembly: AssemblyVersion("6.0.4.0")]
  62
+[assembly: AssemblyVersion("6.0.5.0")]
63 63
 
64 64
 #else
65 65
 
66  
-[assembly: AssemblyVersion("6.0.4.*")]
  66
+[assembly: AssemblyVersion("6.0.5.*")]
67 67
 
68 68
 #endif
60  ImpromptuInterface/src/Dynamic/FluentStringLookup.cs
... ...
@@ -0,0 +1,60 @@
  1
+using System;
  2
+using System.Collections.Generic;
  3
+using System.Dynamic;
  4
+using System.Linq;
  5
+using System.Runtime.Serialization;
  6
+using System.Text;
  7
+using ImpromptuInterface.Internal.Support;
  8
+using ImpromptuInterface.Optimization;
  9
+using System.Reflection;
  10
+namespace ImpromptuInterface.Dynamic
  11
+{
  12
+
  13
+
  14
+    /// <summary>
  15
+    /// Building block to use Method calls as dynamic lookups
  16
+    /// </summary>
  17
+    public class FluentStringLookup:DynamicObject,ICustomTypeProvider
  18
+    {
  19
+        private readonly Func<string, dynamic> _lookup;
  20
+
  21
+        /// <summary>
  22
+        /// Initializes a new instance of the <see cref="FluentStringLookup"/> class.
  23
+        /// </summary>
  24
+        /// <param name="lookup">The lookup.</param>
  25
+        public FluentStringLookup(Func<string,dynamic> lookup)
  26
+        {
  27
+            _lookup = lookup;
  28
+        }
  29
+
  30
+        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
  31
+        {
  32
+            result = _lookup(binder.Name);
  33
+            return true;
  34
+        }
  35
+
  36
+        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)
  37
+        {
  38
+            result = null;
  39
+            if (args.Length == 1 && args.First() is String)
  40
+            {
  41
+                result = _lookup(args[0] as String);
  42
+                return true;
  43
+            }
  44
+            return false;
  45
+        }
  46
+
  47
+#if SILVERLIGHT5
  48
+
  49
+        /// <summary>
  50
+        /// Gets the custom Type.
  51
+        /// </summary>
  52
+        /// <returns></returns>
  53
+        public Type GetCustomType()
  54
+        {
  55
+            return this.GetDynamicCustomType();
  56
+        }
  57
+#endif
  58
+
  59
+    }
  60
+}
4  NuGetBuild/Core/ImpromptuInterface.MetaData.xml
... ...
@@ -1,9 +1,9 @@
1 1
 <metadata>
2 2
   <id>ImpromptuInterface</id>
3  
-  <version>6.0.4</version>
  3
+  <version>6.0.5</version>
4 4
   <authors>Jay Tuley</authors>
5 5
   <owners>Jay Tuley</owners>
6  
-  <description>A Lightweight Duck Casting Framework for dynamic C# 4.0 (.net4 &amp; silverlight4). Includes helper methods for dynamic invocation via method and property names known only at runtime (runs faster than reflection).</description>
  6
+  <description>A Lightweight Duck Casting Framework for dynamic C# 4.0 (.net4 &amp; silverlight4 &amp; silveright5 ). Includes helper methods for dynamic invocation via method and property names known only at runtime (runs faster than reflection).</description>
7 7
   <projectUrl>http://code.google.com/p/impromptu-interface/</projectUrl>
8 8
   <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
9 9
   <iconUrl>http://impromptu-interface.googlecode.com/files/ImpromptuInterface-Icon.png</iconUrl>
4  NuGetBuild/FSharp/ImpromptuInterface.FSharp.MetaData.xml
... ...
@@ -1,6 +1,6 @@
1 1
 <metadata>
2 2
   <id>ImpromptuInterface.FSharp</id>
3  
-  <version>1.2.4</version>
  3
+  <version>1.2.5</version>
4 4
   <authors>Jay Tuley</authors>
5 5
   <owners>Jay Tuley</owners>
6 6
   <description>A complete dlr based dynamic operator implementation for F#</description>
@@ -13,6 +13,6 @@
13 13
     <frameworkAssembly assemblyName="Microsoft.CSharp" />
14 14
   </frameworkAssemblies>
15 15
   <dependencies>
16  
-    <dependency id="ImpromptuInterface" version="6.0.4" />
  16
+    <dependency id="ImpromptuInterface" version="6.0.5" />
17 17
   </dependencies>
18 18
 </metadata>
4  NuGetBuild/MVVM/ImpromptuInterface.MVVM.MetaData.xml
... ...
@@ -1,6 +1,6 @@
1 1
 <metadata>
2 2
   <id>ImpromptuInterface.MVVM</id>
3  
-  <version>4.0.4-beta</version>
  3
+  <version>4.0.5-beta</version>
4 4
   <authors>Jay Tuley</authors>
5 5
   <owners>Jay Tuley</owners>
6 6
   <description>A Lightweight Dynamic MVVM View Model(.net4 &amp; silverlight4 &amp; silverlight5). Removes boilerplate code for MVVM, makes it practical to use MVVM in small apps.</description>
@@ -13,6 +13,6 @@
13 13
     <frameworkAssembly assemblyName="Microsoft.CSharp" />
14 14
   </frameworkAssemblies>
15 15
   <dependencies>
16  
-    <dependency id="ImpromptuInterface" version="6.0.4" />
  16
+    <dependency id="ImpromptuInterface" version="6.0.5" />
17 17
   </dependencies>
18 18
 </metadata>
4  Tests/UnitTestImpromptuInterface/MEFTest.cs
@@ -26,7 +26,7 @@ public void Get_View()
26 26
 
27 27
             IContainer container = new Container(compositionContainer);
28 28
 
29  
-            var view = container.GetView("Test");
  29
+            var view = container.View.Test();
30 30
 
31 31
             Assert.IsInstanceOf<TestView>(view);
32 32
         }
@@ -39,7 +39,7 @@ public void Get_ViewModel()
39 39
 
40 40
             IContainer container = new Container(compositionContainer);
41 41
 
42  
-            var viewModel = container.GetViewModel("Test");
  42
+            var viewModel = container.ViewModel.Test();
43 43
 
44 44
             Assert.IsInstanceOf<TestViewModel>(viewModel);
45 45
         }
4  Tests/UnitTestImpromptuInterface/NinjectTest.cs
@@ -27,7 +27,7 @@ public void Get_View()
27 27
         {
28 28
             var kernel = new StandardKernel();
29 29
             var container = new Container(kernel, typeof(IKernel), _assembly);
30  
-            var view = container.GetView("Test");
  30
+            var view = container.View.Test();
31 31
 
32 32
             Assert.IsInstanceOf<TestView>(view);
33 33
         }
@@ -37,7 +37,7 @@ public void Get_ViewModel()
37 37
         {
38 38
             var kernel = new StandardKernel();
39 39
             var container = new Container(kernel, typeof(IKernel), _assembly);
40  
-            var viewModel = container.GetViewModel("Test");
  40
+            var viewModel = container.ViewModel.Test();
41 41
 
42 42
             Assert.IsInstanceOf<TestViewModel>(viewModel);
43 43
         }
20  Tests/UnitTestImpromptuInterface/RuntimeTest.cs
@@ -33,14 +33,14 @@ public void Standard_MEF_Default_Container()
33 33
         {
34 34
             var runtime = Runtime.Initialize();
35 35
             runtime.SetupContainer();
36  
-            runtime.Start("Test");
  36
+            runtime.Start.Test();
37 37
         }
38 38
 
39 39
         [Test]
40 40
         public void Standard_MEF_Auto_Container()
41 41
         {
42 42
             var runtime = Runtime.Initialize();
43  
-            runtime.Start("Test");
  43
+            runtime.Start.Test();
44 44
         }
45 45
 
46 46
         [Test]
@@ -49,7 +49,7 @@ public void Standard_MEF_IContainer()
49 49
             var container = new CompositionContainer(new TypeCatalog(typeof (TestView), typeof (TestViewModel)));
50 50
             var runtime = Runtime.Initialize();
51 51
             runtime.SetupContainer(new ImpromptuInterface.MVVM.MEF.Container(container));
52  
-            runtime.Start("Test");
  52
+            runtime.Start.Test();
53 53
         }
54 54
 
55 55
         [Test]
@@ -58,33 +58,33 @@ public void Standard_MEF_Container()
58 58
             var container = new CompositionContainer(new TypeCatalog(typeof(TestView), typeof(TestViewModel)));
59 59
             var runtime = Runtime.Initialize();
60 60
             runtime.SetupContainer(container);
61  
-            runtime.Start("Test");
  61
+            runtime.Start.Test();
62 62
         }
63 63
 
64 64
         [Test]
65 65
         public void Fluent_MEF_Default_Container()
66 66
         {
67  
-            Runtime.Initialize().SetupContainer().Start("Test");
  67
+            Runtime.Initialize().SetupContainer().Start.Test();
68 68
         }
69 69
 
70 70
         [Test]
71 71
         public void Fluent_MEF_Auto_Container()
72 72
         {
73  
-            Runtime.Initialize().Start("Test");
  73
+            Runtime.Initialize().Start.Test();
74 74
         }
75 75
 
76 76
         [Test]
77 77
         public void Fluent_MEF_IContainer()
78 78
         {
79 79
             var container = new CompositionContainer(new TypeCatalog(typeof(TestView), typeof(TestViewModel)));
80  
-            Runtime.Initialize().SetupContainer(new ImpromptuInterface.MVVM.MEF.Container(container)).Start("Test");
  80
+            Runtime.Initialize().SetupContainer(new ImpromptuInterface.MVVM.MEF.Container(container)).Start.Test();
81 81
         }
82 82
 
83 83
         [Test]
84 84
         public void Fluent_MEF_Container()
85 85
         {
86 86
             var container = new CompositionContainer(new TypeCatalog(typeof(TestView), typeof(TestViewModel)));
87  
-            Runtime.Initialize().SetupContainer(container).Start("Test");
  87
+            Runtime.Initialize().SetupContainer(container).Start.Test();
88 88
         }
89 89
 
90 90
         #endregion 
@@ -99,7 +99,7 @@ public void Standard_TinyIoC_IContainer()
99 99
             container.AddView("Test", typeof(TestView), typeof(TestViewModel));
100 100
             var runtime = Runtime.Initialize();
101 101
             runtime.SetupContainer(container);
102  
-            runtime.Start("Test");
  102
+            runtime.Start.Test();
103 103
         }
104 104
 
105 105
         [Test]
@@ -166,7 +166,7 @@ public void Fluent_Ninject_Container()
166 166
         {
167 167
             var kernel = new StandardKernel();
168 168
             var runtime = Runtime.Initialize().SetupContainer(kernel);
169  
-            runtime.Start("Test");
  169
+            runtime.Start.Test();
170 170
         }
171 171
 
172 172
         #endregion 
4  Tests/UnitTestImpromptuInterface/TinyIoCTest.cs
@@ -27,7 +27,7 @@ public void Get_View()
27 27
             tinyContainer.Register<object>(new TestView(), "Test__View__");
28 28
             IContainer container = new Container(tinyContainer);
29 29
 
30  
-            var view = container.GetView("Test");
  30
+            var view = container.View.Test();
31 31
 
32 32
             Assert.IsInstanceOf<TestView>(view);
33 33
         }
@@ -39,7 +39,7 @@ public void Get_ViewModel()
39 39
             tinyContainer.Register<object>(new TestViewModel(), "Test__ViewModel__");
40 40
             IContainer container = new Container(tinyContainer);
41 41
 
42  
-            var viewModel = container.GetViewModel("Test");
  42
+            var viewModel = container.ViewModel.Test();
43 43
 
44 44
             Assert.IsInstanceOf<TestViewModel>(viewModel);
45 45
         }
4  Tests/UnitTestImpromptuInterface/UnityTest.cs
@@ -30,7 +30,7 @@ public void Get_View()
30 30
             unityContainer.RegisterInstance(typeof(object), "Test__View__", new TestView());
31 31
             IContainer container = new Container(unityContainer, typeof(IUnityContainer));
32 32
 
33  
-            var view = container.GetView("Test");
  33
+            var view = container.View.Test();
34 34
 
35 35
             Assert.IsInstanceOf<TestView>(view);
36 36
         }
@@ -42,7 +42,7 @@ public void Get_ViewModel()
42 42
             unityContainer.RegisterInstance(typeof(object), "Test__ViewModel__", new TestViewModel());
43 43
             IContainer container = new Container(unityContainer, typeof(IUnityContainer));
44 44
 
45  
-            var viewModel = container.GetViewModel("Test");
  45
+            var viewModel = container.ViewModel.Test();
46 46
 
47 47
             Assert.IsInstanceOf<TestViewModel>(viewModel);
48 48
         }

0 notes on commit 958d694

Please sign in to comment.
Something went wrong with that request. Please try again.