Permalink
Browse files

Updated

  • Loading branch information...
1 parent e952061 commit d4b84adb04e8c1ab921382fcf2ded5c0131db815 @developwithpassion developwithpassion committed Sep 23, 2011
@@ -3,14 +3,15 @@
using Machine.Specifications;
using developwithpassion.specifications.rhinomocks;
using nothinbutdotnetstore.web.application.catalogbrowsing;
+using nothinbutdotnetstore.web.application.catalogbrowsing.stubs;
using nothinbutdotnetstore.web.core;
namespace nothinbutdotnetstore.specs
{
public class ViewTheDepartmentsInADepartmentRequestMapperSpecs
{
- public abstract class concern : Observes<IMapAn<ViewTheDepartmentsOfADepartmentRequest>,
- ViewTheDepartmentsOfADepartmentRequestMapper>
+ public abstract class concern : Observes<IMapAnInputModelOf<ViewTheDepartmentsOfADepartmentRequest>,
+ StubViewTheDepartmentsOfADepartmentRequestMapper>
{
}
@@ -105,15 +105,16 @@
<Compile Include="web\application\catalogbrowsing\IFetchA.cs" />
<Compile Include="web\application\catalogbrowsing\IRetrieveStoreInformation.cs" />
<Compile Include="web\application\catalogbrowsing\Product.cs" />
+ <Compile Include="web\application\catalogbrowsing\stubs\StubInputModelMapper.cs" />
<Compile Include="web\application\catalogbrowsing\ViewTheDepartmentsOfADepartmentRequest.cs" />
- <Compile Include="web\application\catalogbrowsing\ViewTheDepartmentsOfADepartmentRequestMapper.cs" />
+ <Compile Include="web\application\catalogbrowsing\ViewTheMainDepartmentsRequest.cs" />
<Compile Include="web\application\catalogbrowsing\ViewTheProductsInADepartmentInputModel.cs" />
<Compile Include="web\core\aspnet\IFindPathsToViews.cs" />
<Compile Include="web\core\aspnet\WebFormFactory.cs" />
<Compile Include="web\core\aspnet\WebFormViewRegistry.cs" />
<Compile Include="web\core\CommandRegistry.cs" />
<Compile Include="web\core\GetTheCurrentlyExecutingContext.cs" />
- <Compile Include="web\core\IMapAn.cs" />
+ <Compile Include="web\core\IMapAnInputModelOf.cs" />
<Compile Include="web\core\link_builder\IBuildLinks.cs" />
<Compile Include="web\core\link_builder\IManageTokens.cs" />
<Compile Include="web\core\link_builder\IProcessAToken.cs" />
@@ -153,9 +154,7 @@
<Compile Include="web\core\stubs\StubSetOfCommands.cs" />
<Compile Include="web\core\stubs\StubViewPathRegistry.cs" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="web\application\catalogbrowsing\stubs\" />
- </ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -28,8 +28,19 @@ public static void run()
static void populate_factories()
{
- factories.Add(new SimpleTypeKey((typeof(IFindCommands))), new SimpleDependencyFactory(() => Stub.with<StubCommandRegistry>()));
- factories.Add(new SimpleTypeKey(typeof(IProcessRequests)), new SimpleDependencyFactory(() => new FrontController(Depends.on.a<IFindCommands>())));
+ register<IProcessRequests>(() => new FrontController(Depends.on.a<IFindCommands>()));
+
+ register<IFindCommands>(() => new CommandRegistry(
+ Depends.on.a<IEnumerable<IProcessOneRequest>>(),
+ Depends.on.a<IProcessOneRequest>()));
+
+ register<IEnumerable<IProcessOneRequest>>(() => Stub.with<StubSetOfCommands>());
+ }
+
+ static void register<Contract>(Func<object> implementation)
+ {
+ factories.Add(new SimpleTypeKey(typeof(Contract)), new
+ SimpleDependencyFactory(implementation))
}
}
@@ -1,11 +1,6 @@
-using System;
-
namespace nothinbutdotnetstore.web.application.catalogbrowsing
{
public class ViewTheDepartmentsOfADepartmentRequest
{
- public long department_id { get; set; }
- public DateTime introduced_into_store_on { get; set; }
- public int number_of_items { get; set; }
}
}
@@ -1,21 +0,0 @@
-using System.Collections.Specialized;
-using nothinbutdotnetstore.utility;
-using nothinbutdotnetstore.web.core;
-
-namespace nothinbutdotnetstore.web.application.catalogbrowsing
-{
- public class ViewTheDepartmentsOfADepartmentRequestMapper : IMapAn<ViewTheDepartmentsOfADepartmentRequest>
- {
- public ViewTheDepartmentsOfADepartmentRequest map_from(NameValueCollection item)
- {
- return new ViewTheDepartmentsOfADepartmentRequest
- {
- department_id = PayloadTokens.view_departments_in_department_request.department_id.map_from(item),
- introduced_into_store_on =
- PayloadTokens.view_departments_in_department_request.introduced_into_store_on.map_from(item),
- number_of_items = PayloadTokens.view_departments_in_department_request.number_of_items.map_from(item)
- };
- }
-
- }
-}
@@ -0,0 +1,7 @@
+namespace nothinbutdotnetstore.web.application.catalogbrowsing
+{
+ public class ViewTheMainDepartmentsRequest
+ {
+
+ }
+}
@@ -0,0 +1,13 @@
+using System.Collections.Specialized;
+using nothinbutdotnetstore.web.core;
+
+namespace nothinbutdotnetstore.web.application.catalogbrowsing.stubs
+{
+ public class StubInputModelMapper<InputModel>:IMapAnInputModelOf<InputModel> where InputModel:new()
+ {
+ public InputModel map_from(NameValueCollection item)
+ {
+ return new InputModel();
+ }
+ }
+}
@@ -2,7 +2,7 @@
namespace nothinbutdotnetstore.web.core
{
- public interface IMapAn<InputModel> : IMapDetails<NameValueCollection,InputModel>
+ public interface IMapAnInputModelOf<InputModel> : IMapDetails<NameValueCollection,InputModel>
{
}
@@ -2,7 +2,7 @@
namespace nothinbutdotnetstore.web.core
{
- public class ViewMainDeparmentsRequestMapper : IMapAn<ViewMainDepartmentsRequest>
+ public class ViewMainDeparmentsRequestMapper : IMapAnInputModelOf<ViewMainDepartmentsRequest>
{
public ViewMainDepartmentsRequest map_from(NameValueCollection item)
{

0 comments on commit d4b84ad

Please sign in to comment.