Commit c6495e6
Changed files (64)
trunk
src
MyMoney
DataAccess
Domain
accounting
Infrastructure
Container
interceptors
Logging
registries
Threading
transactions
Presentation
Context
Model
Menu
Projects
reporting
updates
Presenters
Commands
Navigation
Shell
Startup
Views
Tasks
infrastructure
Testing
spechelpers
contexts
Utility
Extensions
trunk/src/MyMoney/DataAccess/db40/db4o_repository_specs.cs
@@ -5,6 +5,7 @@ using MyMoney.Domain.Core;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.DataAccess.db40
{
@@ -35,8 +36,8 @@ namespace MyMoney.DataAccess.db40
second_item = an<IEntity>();
var session = an<IObjectContainer>();
- factory.is_told_to(x => x.create()).it_will_return(session);
- session.is_told_to(x => x.Query<IEntity>()).it_will_return(new List<IEntity>
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, x => x.create()), session);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(session, x => x.Query<IEntity>()), new List<IEntity>
{first_item, second_item});
};
trunk/src/MyMoney/DataAccess/db40/session_factory_specs.cs
@@ -4,6 +4,7 @@ using MyMoney.Presentation.Model.Projects;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.DataAccess.db40
{
@@ -35,12 +36,8 @@ namespace MyMoney.DataAccess.db40
var the_path_to_the_database_file = an<IFile>();
session = an<IObjectContainer>();
- database_configuration
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(the_path_to_the_database_file);
- connection_factory
- .is_told_to(x => x.open_connection_to(the_path_to_the_database_file))
- .it_will_return(session);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(database_configuration, x => x.path_to_the_database()), the_path_to_the_database_file);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(connection_factory, x => x.open_connection_to(the_path_to_the_database_file)), session);
};
because b = () => { result = sut.create(); };
@@ -52,7 +49,7 @@ namespace MyMoney.DataAccess.db40
public class when_creating_a_session_for_a_file_that_has_already_been_opened : behaves_like_a_session_factory
{
it should_only_open_the_connection_once =
- () => connection_factory.was_told_to(x => x.open_connection_to(the_path_to_the_database_file)).only_once();
+ () => mocking_extensions.was_told_to(connection_factory, x => x.open_connection_to(the_path_to_the_database_file)).only_once();
it should_return_the_original_connection = () => result.should_be_equal_to(original_connection);
@@ -61,13 +58,9 @@ namespace MyMoney.DataAccess.db40
the_path_to_the_database_file = an<IFile>();
original_connection = an<IObjectContainer>();
- when_the(database_configuration)
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(the_path_to_the_database_file);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(database_configuration), x => x.path_to_the_database()), the_path_to_the_database_file);
- when_the(connection_factory)
- .is_told_to(x => x.open_connection_to(the_path_to_the_database_file))
- .it_will_return(original_connection);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(connection_factory), x => x.open_connection_to(the_path_to_the_database_file)), original_connection);
};
because b = () =>
@@ -83,7 +76,7 @@ namespace MyMoney.DataAccess.db40
public class when_opening_a_new_file_after_one_has_already_been_opened : behaves_like_a_session_factory
{
- it should_close_the_previous_file = () => original_connection.was_told_to(x => x.Close()).only_once();
+ it should_close_the_previous_file = () => mocking_extensions.was_told_to(original_connection, x => x.Close()).only_once();
context c = () =>
{
@@ -91,19 +84,13 @@ namespace MyMoney.DataAccess.db40
var a_new_path = an<IFile>();
original_connection = an<IObjectContainer>();
- database_configuration
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(the_path_to_the_database_file)
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(database_configuration, x => x.path_to_the_database()), the_path_to_the_database_file)
.Repeat.Once();
- database_configuration
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(a_new_path)
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(database_configuration, x => x.path_to_the_database()), a_new_path)
.Repeat.Once();
- connection_factory
- .is_told_to(x => x.open_connection_to(the_path_to_the_database_file))
- .it_will_return(original_connection);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(connection_factory, x => x.open_connection_to(the_path_to_the_database_file)), original_connection);
};
because b = () =>
trunk/src/MyMoney/Domain/accounting/billing/company_specs.cs
@@ -2,9 +2,9 @@ using System;
using jpboodhoo.bdd.contexts;
using MyMoney.Domain.accounting.financial_growth;
using MyMoney.Domain.Core;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Domain.accounting.billing
{
trunk/src/MyMoney/Domain/accounting/account_holder_specs.cs
@@ -7,6 +7,7 @@ using MyMoney.Domain.Core;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Domain.accounting
{
@@ -33,9 +34,9 @@ namespace MyMoney.Domain.accounting
second_unpaid_bill = an<IBill>();
paid_bill = an<IBill>();
- first_unpaid_bill.is_told_to(x => x.is_paid_for()).it_will_return(false);
- second_unpaid_bill.is_told_to(x => x.is_paid_for()).it_will_return(false);
- paid_bill.is_told_to(x => x.is_paid_for()).it_will_return(true);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(first_unpaid_bill, x => x.is_paid_for()), false);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(second_unpaid_bill, x => x.is_paid_for()), false);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(paid_bill, x => x.is_paid_for()), true);
};
because b = () =>
@@ -61,26 +62,14 @@ namespace MyMoney.Domain.accounting
income_for_february_2007 = an<IIncome>();
income_for_february_2008 = an<IIncome>();
- income_for_january_2007
- .is_told_to(x => x.date_of_issue)
- .it_will_return(new DateTime(2007, 01, 01).as_a_date());
- income_for_january_2007
- .is_told_to(x => x.amount_tendered)
- .it_will_return(new money(1000, 00));
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_january_2007, x => x.date_of_issue), new DateTime(2007, 01, 01).as_a_date());
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_january_2007, x => x.amount_tendered), new money(1000, 00));
- income_for_february_2007
- .is_told_to(x => x.date_of_issue)
- .it_will_return(new DateTime(2007, 02, 01).as_a_date());
- income_for_february_2007
- .is_told_to(x => x.amount_tendered)
- .it_will_return(new money(1000, 00));
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_february_2007, x => x.date_of_issue), new DateTime(2007, 02, 01).as_a_date());
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_february_2007, x => x.amount_tendered), new money(1000, 00));
- income_for_february_2008
- .is_told_to(x => x.date_of_issue)
- .it_will_return(new DateTime(2008, 02, 01).as_a_date());
- income_for_february_2008
- .is_told_to(x => x.amount_tendered)
- .it_will_return(new money(1000, 00));
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_february_2008, x => x.date_of_issue), new DateTime(2008, 02, 01).as_a_date());
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(income_for_february_2008, x => x.amount_tendered), new money(1000, 00));
};
because b = () =>
trunk/src/MyMoney/Domain/accounting/GeneralLedgerSpecs.cs
@@ -6,6 +6,7 @@ using MyMoney.Domain.Core;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Domain.accounting
{
@@ -50,9 +51,9 @@ namespace MyMoney.Domain.accounting
february_twenty_first = an<ILedgerEntry>();
april_first = an<ILedgerEntry>();
- february_first.is_told_to(x => x.entry_date()).Return(new DateTime(2008, 02, 01));
- february_twenty_first.is_told_to(x => x.entry_date()).Return(new DateTime(2008, 02, 21));
- april_first.is_told_to(x => x.entry_date()).Return(new DateTime(2008, 04, 01));
+ mocking_extensions.is_told_to(february_first, x => x.entry_date()).Return(new DateTime(2008, 02, 01));
+ mocking_extensions.is_told_to(february_twenty_first, x => x.entry_date()).Return(new DateTime(2008, 02, 21));
+ mocking_extensions.is_told_to(april_first, x => x.entry_date()).Return(new DateTime(2008, 04, 01));
};
because b = () => { result = sut.get_all_the_entries_for(Months.February); };
trunk/src/MyMoney/Infrastructure/Container/Windsor/windsor_dependency_registry_specs.cs
@@ -4,6 +4,7 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.Container.Windsor
{
@@ -28,7 +29,7 @@ namespace MyMoney.Infrastructure.Container.Windsor
[Concern(typeof (windsor_dependency_registry))]
public class when_creating_the_windsor_resolver_ : concerns_for<IDependencyRegistry>
{
- it should_leverage_the_factory_to_create_the_underlying_container = () => factory.was_told_to(f => f.create());
+ it should_leverage_the_factory_to_create_the_underlying_container = () => mocking_extensions.was_told_to(factory, f => f.create());
public override IDependencyRegistry create_sut()
{
@@ -39,7 +40,7 @@ namespace MyMoney.Infrastructure.Container.Windsor
{
var container = an<IWindsorContainer>();
factory = an<IWindsorContainerFactory>();
- factory.is_told_to(f => f.create()).it_will_return(container);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, f => f.create()), container);
};
trunk/src/MyMoney/Infrastructure/Container/ResolveSpecs.cs
@@ -5,6 +5,7 @@ using MyMoney.Testing;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.Container
{
@@ -19,16 +20,14 @@ namespace MyMoney.Infrastructure.Container
{
registry = an<IDependencyRegistry>();
presenter = an<IPresenter>();
- registry
- .is_told_to(x => x.find_an_implementation_of<IPresenter>())
- .it_will_return(presenter);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(registry, x => x.find_an_implementation_of<IPresenter>()), presenter);
resolve.initialize_with(registry);
};
because b = () => { result = resolve.dependency_for<IPresenter>(); };
it should_leverage_the_underlying_container_it_was_initialized_with =
- () => registry.was_told_to(x => x.find_an_implementation_of<IPresenter>());
+ () => mocking_extensions.was_told_to(registry, x => x.find_an_implementation_of<IPresenter>());
it should_return_the_resolved_dependency = () => result.should_be_equal_to(presenter);
@@ -44,9 +43,7 @@ namespace MyMoney.Infrastructure.Container
context c = () =>
{
registry = an<IDependencyRegistry>();
- registry
- .is_told_to(x => x.find_an_implementation_of<IPresenter>())
- .it_will_throw(new Exception());
+ mocking_extensions.it_will_throw(mocking_extensions.is_told_to(registry, x => x.find_an_implementation_of<IPresenter>()), new Exception());
resolve.initialize_with(registry);
};
trunk/src/MyMoney/Infrastructure/interceptors/lazy_specs.cs
@@ -3,6 +3,7 @@ using MyMoney.Infrastructure.Container;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.interceptors
{
@@ -22,14 +23,12 @@ namespace MyMoney.Infrastructure.interceptors
public class when_calling_a_method_with_no_arguments_on_a_lazy_loaded_proxy : behaves_like_a_lazy_loaded_object
{
- it should_forward_the_original_call_to_the_target = () => target.was_told_to(t => t.OneMethod());
+ it should_forward_the_original_call_to_the_target = () => mocking_extensions.was_told_to(target, t => t.OneMethod());
context c = () =>
{
target = an<ITargetObject>();
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target).Repeat.Once();
};
because b = () =>
@@ -50,10 +49,8 @@ namespace MyMoney.Infrastructure.interceptors
{
var target = an<ITargetObject>();
- target.is_told_to(x => x.FirstValueReturningMethod()).it_will_return(10);
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target)
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(target, x => x.FirstValueReturningMethod()), 10);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target)
.Repeat.Once();
};
@@ -69,14 +66,12 @@ namespace MyMoney.Infrastructure.interceptors
public class when_calling_different_methods_on_an_proxied_object : behaves_like_a_lazy_loaded_object
{
it should_only_load_the_object_once =
- () => test_container.was_told_to(x => x.find_an_implementation_of<ITargetObject>()).only_once();
+ () => mocking_extensions.was_told_to(test_container, x => x.find_an_implementation_of<ITargetObject>()).only_once();
context c = () =>
{
var target = an<ITargetObject>();
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target).Repeat.Once();
};
because b = () =>
@@ -91,7 +86,7 @@ namespace MyMoney.Infrastructure.interceptors
behaves_like_a_lazy_loaded_object
{
it should_forward_the_call_to_the_original_target =
- () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument(88));
+ () => mocking_extensions.was_told_to(target, x => x.ValueReturningMethodWithAnArgument(88));
it should_return_the_correct_result = () => result.should_be_equal_to(99);
@@ -99,10 +94,8 @@ namespace MyMoney.Infrastructure.interceptors
{
target = an<ITargetObject>();
- target.is_told_to(x => x.ValueReturningMethodWithAnArgument(88)).it_will_return(99);
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(target, x => x.ValueReturningMethodWithAnArgument(88)), 99);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target).Repeat.Once();
};
because b = () =>
@@ -124,9 +117,7 @@ namespace MyMoney.Infrastructure.interceptors
var target = an<ITargetObject>();
target.GetterAndSetterProperty = "mo";
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target).Repeat.Once();
};
because b = () =>
@@ -141,15 +132,13 @@ namespace MyMoney.Infrastructure.interceptors
public class when_setting_the_value_of_a_property_on_a_proxied_object : behaves_like_a_lazy_loaded_object
{
it should_set_the_value_on_the_original_target =
- () => target.was_told_to(x => x.GetterAndSetterProperty = "khan");
+ () => mocking_extensions.was_told_to(target, x => x.GetterAndSetterProperty = "khan");
context c = () =>
{
target = dependency<ITargetObject>();
- test_container
- .is_told_to(t => t.find_an_implementation_of<ITargetObject>())
- .it_will_return(target)
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<ITargetObject>()), target)
.Repeat.Once();
};
@@ -165,7 +154,7 @@ namespace MyMoney.Infrastructure.interceptors
public class when_calling_a_generic_method_on_a_proxied_object : behaves_like_a_lazy_loaded_object
{
it should_forward_the_call_to_the_target =
- () => target.was_told_to(x => x.ValueReturningMethodWithAnArgument("blah"));
+ () => mocking_extensions.was_told_to(target, x => x.ValueReturningMethodWithAnArgument("blah"));
it should_return_the_correct_result = () => result.should_be_equal_to("hooray");
@@ -173,10 +162,8 @@ namespace MyMoney.Infrastructure.interceptors
{
target = an<IGenericInterface<string>>();
- target.is_told_to(x => x.ValueReturningMethodWithAnArgument("blah")).it_will_return("hooray");
- test_container
- .is_told_to(t => t.find_an_implementation_of<IGenericInterface<string>>())
- .it_will_return(target).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(target, x => x.ValueReturningMethodWithAnArgument("blah")), "hooray");
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(test_container, t => t.find_an_implementation_of<IGenericInterface<string>>()), target).Repeat.Once();
};
because b = () =>
trunk/src/MyMoney/Infrastructure/Logging/LogSpecs.cs
@@ -3,6 +3,7 @@ using MyMoney.Infrastructure.Container;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.Logging
{
@@ -16,13 +17,9 @@ namespace MyMoney.Infrastructure.Logging
var factory = an<ILogFactory>();
var registry = an<IDependencyRegistry>();
logger = an<ILogger>();
- registry
- .is_told_to(x => x.find_an_implementation_of<ILogFactory>())
- .it_will_return(factory);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(registry, x => x.find_an_implementation_of<ILogFactory>()), factory);
- factory
- .is_told_to(x => x.create_for(typeof (string)))
- .it_will_return(logger);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, x => x.create_for(typeof (string))), logger);
resolve.initialize_with(registry);
};
trunk/src/MyMoney/Infrastructure/registries/default_registry_specs.cs
@@ -5,6 +5,7 @@ using MyMoney.Infrastructure.Container;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.registries
{
@@ -13,7 +14,7 @@ namespace MyMoney.Infrastructure.registries
concerns_for<IRegistry<int>, default_registry<int>>
{
it should_leverage_the_resolver_to_retrieve_all_the_implementations =
- () => registry.was_told_to(r => r.all_implementations_of<int>());
+ () => mocking_extensions.was_told_to(registry, r => r.all_implementations_of<int>());
it should_return_the_items_resolved_by_the_registry = () => result.should_contain(24);
@@ -22,7 +23,7 @@ namespace MyMoney.Infrastructure.registries
var items_to_return = new List<int> {24};
registry = an<IDependencyRegistry>();
- registry.is_told_to(r => r.all_implementations_of<int>()).it_will_return(items_to_return);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(registry, r => r.all_implementations_of<int>()), items_to_return);
};
public override IRegistry<int> create_sut()
trunk/src/MyMoney/Infrastructure/Threading/background_thread_factory_specs.cs
@@ -4,6 +4,7 @@ using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
using MyMoney.Utility.Core;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.Threading
{
@@ -26,7 +27,7 @@ namespace MyMoney.Infrastructure.Threading
it should_return_an_instance_of_a_background_thread = () => result.should_not_be_null();
it should_lookup_an_instance_of_the_command_to_execute =
- () => registry.was_told_to(r => r.find_an_implementation_of<IDisposableCommand>());
+ () => mocking_extensions.was_told_to(registry, r => r.find_an_implementation_of<IDisposableCommand>());
because b = () => { result = sut.create_for<IDisposableCommand>(); };
trunk/src/MyMoney/Infrastructure/Threading/background_thread_specs.cs
@@ -1,7 +1,7 @@
using jpboodhoo.bdd.contexts;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
using MyMoney.Utility.Core;
using Rhino.Mocks;
trunk/src/MyMoney/Infrastructure/Threading/command_processor_specs.cs
@@ -1,7 +1,7 @@
using jpboodhoo.bdd.contexts;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
using MyMoney.Utility.Core;
namespace MyMoney.Infrastructure.Threading
trunk/src/MyMoney/Infrastructure/Threading/interval_timer_specs.cs
@@ -1,9 +1,9 @@
using System;
using System.Timers;
using jpboodhoo.bdd.contexts;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
using Rhino.Mocks;
namespace MyMoney.Infrastructure.Threading
trunk/src/MyMoney/Infrastructure/transactions/unit_of_work_registry_specs.cs
@@ -3,6 +3,7 @@ using MyMoney.Domain.Core;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Infrastructure.transactions
{
@@ -21,14 +22,14 @@ namespace MyMoney.Infrastructure.transactions
public class when_starting_a_unit_of_work_for_a_new_type : behaves_like_unit_of_work_registery
{
- it should_register_a_new_unit_of_work = () => factory.was_told_to(x => x.create_for<IEntity>());
+ it should_register_a_new_unit_of_work = () => mocking_extensions.was_told_to(factory, x => x.create_for<IEntity>());
it should_return_the_new_unit_of_work = () => result.should_be_equal_to(unit_of_work);
context c = () =>
{
unit_of_work = an<IUnitOfWork<IEntity>>();
- factory.is_told_to(x => x.create_for<IEntity>()).it_will_return(unit_of_work);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, x => x.create_for<IEntity>()), unit_of_work);
};
because b = () => { result = sut.start_unit_of_work_for<IEntity>(); };
@@ -46,9 +47,7 @@ namespace MyMoney.Infrastructure.transactions
{
unit_of_work = an<IUnitOfWork<IEntity>>();
- factory
- .is_told_to(x => x.create_for<IEntity>())
- .it_will_return(unit_of_work)
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, x => x.create_for<IEntity>()), unit_of_work)
.Repeat.Once();
};
@@ -64,12 +63,12 @@ namespace MyMoney.Infrastructure.transactions
public class when_committing_all_the_active_units_of_work : behaves_like_unit_of_work_registery
{
- it should_commit_each_one = () => unit_of_work.was_told_to(x => x.commit());
+ it should_commit_each_one = () => mocking_extensions.was_told_to(unit_of_work, x => x.commit());
context c = () =>
{
unit_of_work = an<IUnitOfWork<IEntity>>();
- factory.is_told_to(x => x.create_for<IEntity>()).it_will_return(unit_of_work).Repeat.Once();
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, x => x.create_for<IEntity>()), unit_of_work).Repeat.Once();
};
because b = () =>
trunk/src/MyMoney/Infrastructure/transactions/unit_of_work_specs.cs
@@ -1,8 +1,8 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Domain.Core;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Infrastructure.transactions
{
trunk/src/MyMoney/Presentation/Context/the_application_context_specs.cs
@@ -7,6 +7,7 @@ using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
using Rhino.Mocks;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Presentation.Context
{
@@ -34,7 +35,7 @@ namespace MyMoney.Presentation.Context
{
it should_specify_the_main_shell_view_as_the_main_form = () => result.should_be_equal_to(shell_view);
- it should_run_the_main_shell_presenter = () => load_application.was_told_to(x => x.run());
+ it should_run_the_main_shell_presenter = () => mocking_extensions.was_told_to(load_application, x => x.run());
because b = () => { result = sut.MainForm; };
static Form result;
@@ -42,7 +43,7 @@ namespace MyMoney.Presentation.Context
public class when_the_application_shell_is_closed : behaves_like_an_application_context
{
- it should_shut_the_application_down = () => exit_command.was_told_to(x => x.run());
+ it should_shut_the_application_down = () => mocking_extensions.was_told_to(exit_command, x => x.run());
because b = () => shell_view.Raise(x => x.Closed += null, null, null);
}
trunk/src/MyMoney/Presentation/Core/application_controller_specs.cs
@@ -3,9 +3,9 @@ using System.Linq;
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Views.core;
using MyMoney.Presentation.Views.Shell;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Core
{
trunk/src/MyMoney/Presentation/Databindings/binding_selector_specs.cs
@@ -4,6 +4,7 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Presentation.Databindings
{
@@ -14,7 +15,7 @@ namespace MyMoney.Presentation.Databindings
() => result.property.Name.should_be_equal_to("FirstName");
it should_inspect_the_expression_for_the_property_information =
- () => inspector.was_told_to(i => i.inspect(expression_to_parse));
+ () => mocking_extensions.was_told_to(inspector, i => i.inspect(expression_to_parse));
context c = () =>
{
@@ -22,13 +23,10 @@ namespace MyMoney.Presentation.Databindings
factory = an<IPropertyInspectorFactory>();
inspector = an<IPropertyInspector<IAnInterface, string>>();
- factory
- .is_told_to(f => f.create<IAnInterface, string>())
- .it_will_return(inspector);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(factory, f => f.create<IAnInterface, string>()), inspector);
- inspector.is_told_to(i => i.inspect(null))
- .IgnoreArguments()
- .it_will_return(typeof (IAnInterface).GetProperty("FirstName"));
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(inspector, i => i.inspect(null))
+ .IgnoreArguments(), typeof (IAnInterface).GetProperty("FirstName"));
};
because b = () =>
trunk/src/MyMoney/Presentation/Databindings/ComboBoxDataBindingSpecs.cs
@@ -3,6 +3,7 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Presentation.Databindings
{
@@ -22,9 +23,7 @@ namespace MyMoney.Presentation.Databindings
combo_box.Items.Add(baby_boy);
combo_box.Items.Add(baby_girl);
- when_the(thing_to_bind_to)
- .is_asked_for(t => t.Child)
- .it_will_return(baby_girl);
+ mocking_extensions.it_will_return(mocking_extensions.is_asked_for(when_the(thing_to_bind_to), t => t.Child), baby_girl);
};
because b = () => Create
trunk/src/MyMoney/Presentation/Databindings/TextBoxDataBindingSpecs.cs
@@ -3,6 +3,7 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Presentation.Databindings
{
@@ -16,7 +17,7 @@ namespace MyMoney.Presentation.Databindings
{
thing_to_bind_to = an<IAnInterface>();
text_box = new TextBox();
- thing_to_bind_to.is_asked_for(t => t.FirstName).it_will_return(first_name);
+ mocking_extensions.it_will_return(mocking_extensions.is_asked_for(thing_to_bind_to, t => t.FirstName), first_name);
};
because b = () => Create
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/exit_command_specs.cs
@@ -2,9 +2,9 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Infrastructure.eventing;
using MyMoney.Infrastructure.System;
using MyMoney.Presentation.Model.messages;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/new_command_specs.cs
@@ -1,9 +1,9 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Model.Projects;
using MyMoney.Presentation.Presenters.Commands;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/open_command_specs.cs
@@ -2,9 +2,9 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Model.Projects;
using MyMoney.Presentation.Presenters.Commands;
using MyMoney.Presentation.Views.dialogs;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/save_as_command.cs
@@ -5,12 +5,13 @@ using MyMoney.Utility.Core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
public interface ISaveAsCommand : ICommand
- {}
+ {
+ }
public class save_as_command : ISaveAsCommand
{
- private readonly IProject current_project;
- private readonly ISelectFileToSaveToDialog view;
+ readonly IProject current_project;
+ readonly ISelectFileToSaveToDialog view;
public save_as_command(ISelectFileToSaveToDialog view, IProject current_project)
{
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/save_as_command_specs.cs
@@ -1,9 +1,9 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Model.Projects;
using MyMoney.Presentation.Views.dialogs;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/save_command.cs
@@ -4,12 +4,13 @@ using MyMoney.Utility.Core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
public interface ISaveCommand : ICommand
- {}
+ {
+ }
public class save_command : ISaveCommand
{
- private readonly IProject the_current_project;
- private readonly ISaveAsCommand save_as_command;
+ readonly IProject the_current_project;
+ readonly ISaveAsCommand save_as_command;
public save_command(IProject current_project, ISaveAsCommand save_as_command)
{
@@ -19,10 +20,12 @@ namespace MyMoney.Presentation.Model.Menu.File.Commands
public void run()
{
- if (the_current_project.has_been_saved_at_least_once()) {
+ if (the_current_project.has_been_saved_at_least_once())
+ {
the_current_project.save_changes();
}
- else {
+ else
+ {
save_as_command.run();
}
}
trunk/src/MyMoney/Presentation/Model/Menu/File/Commands/save_command_specs.cs
@@ -1,8 +1,8 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Model.Projects;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.Menu.File.Commands
{
trunk/src/MyMoney/Presentation/Model/Menu/Help/commands/display_information_about_the_application.cs
@@ -5,7 +5,8 @@ using MyMoney.Utility.Core;
namespace MyMoney.Presentation.Model.Menu.Help.commands
{
public interface IDisplayInformationAboutTheApplication : ICommand
- {}
+ {
+ }
public class display_information_about_the_application : IDisplayInformationAboutTheApplication
{
@@ -16,9 +17,9 @@ namespace MyMoney.Presentation.Model.Menu.Help.commands
public void run()
{
- run_presenter.execute<IAboutApplicationPresenter>();
+ run_presenter.run<IAboutApplicationPresenter>();
}
- private readonly IRunPresenterCommand run_presenter;
+ readonly IRunPresenterCommand run_presenter;
}
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Model/Projects/current_project_specs.cs
@@ -6,6 +6,7 @@ using MyMoney.Testing;
using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Presentation.Model.Projects
{
@@ -30,19 +31,15 @@ namespace MyMoney.Presentation.Model.Projects
public class when_saving_the_current_project : behaves_like_a_project
{
it should_save_the_current_database_to_the_path_specified_by_the_user =
- () => current_file.was_told_to(x => x.copy_to(file_to_update));
+ () => mocking_extensions.was_told_to(current_file, x => x.copy_to(file_to_update));
context c = () =>
{
file_to_update = an<IFile>();
current_file = an<IFile>();
- when_the(configuration)
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(current_file);
- when_the(file_to_update)
- .is_told_to(x => x.does_the_file_exist())
- .it_will_return(true);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(configuration), x => x.path_to_the_database()), current_file);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(file_to_update), x => x.does_the_file_exist()), true);
};
because b = () =>
@@ -67,7 +64,7 @@ namespace MyMoney.Presentation.Model.Projects
public class when_specifying_a_new_path_to_save_an_opened_project_to : behaves_like_a_project
{
- it should_save_the_current_database_to_the_new_path = () => database_file.was_told_to(x => x.copy_to(new_file));
+ it should_save_the_current_database_to_the_new_path = () => mocking_extensions.was_told_to(database_file, x => x.copy_to(new_file));
context c = () =>
{
@@ -75,12 +72,8 @@ namespace MyMoney.Presentation.Model.Projects
new_file = an<IFile>();
database_file = an<IFile>();
- when_the(configuration)
- .is_told_to(x => x.path_to_the_database())
- .it_will_return(database_file);
- when_the(new_file)
- .is_told_to(x => x.path)
- .it_will_return("blah");
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(configuration), x => x.path_to_the_database()), database_file);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(new_file), x => x.path), "blah");
};
because b = () =>
@@ -101,7 +94,7 @@ namespace MyMoney.Presentation.Model.Projects
context c = () =>
{
invalid_file = an<IFile>();
- when_the(invalid_file).is_told_to(x => x.does_the_file_exist()).it_will_return(false);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(invalid_file), x => x.does_the_file_exist()), false);
};
because b = () =>
@@ -122,9 +115,7 @@ namespace MyMoney.Presentation.Model.Projects
{
invalid_file = an<IFile>();
- when_the(invalid_file)
- .is_told_to(x => x.path)
- .it_will_return(string.Empty);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(invalid_file), x => x.path), string.Empty);
};
because b = () =>
@@ -143,9 +134,7 @@ namespace MyMoney.Presentation.Model.Projects
{
file = an<IFile>();
- when_the(file)
- .is_told_to(x => x.does_the_file_exist())
- .it_will_return(true);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(file), x => x.does_the_file_exist()), true);
};
because b = () => sut.open(file);
trunk/src/MyMoney/Presentation/Model/reporting/report_binding_extensions_specs.cs
@@ -1,9 +1,9 @@
using System;
using DataDynamics.ActiveReports;
using jpboodhoo.bdd.contexts;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Model.reporting
{
trunk/src/MyMoney/Presentation/Model/updates/ApplicationVersion.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace MyMoney.Presentation.Model.updates
+{
+ public class ApplicationVersion
+ {
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Presenters/Commands/run_presenter_command.cs
@@ -4,7 +4,7 @@ namespace MyMoney.Presentation.Presenters.Commands
{
public interface IRunPresenterCommand
{
- void execute<Presenter>() where Presenter : IPresenter;
+ void run<Presenter>() where Presenter : IPresenter;
}
public class run_presenter_command : IRunPresenterCommand
@@ -16,7 +16,7 @@ namespace MyMoney.Presentation.Presenters.Commands
application_controller = applicationController;
}
- public void execute<Presenter>() where Presenter : IPresenter
+ public void run<Presenter>() where Presenter : IPresenter
{
application_controller.run<Presenter>();
}
trunk/src/MyMoney/Presentation/Presenters/Commands/run_the_specs.cs
@@ -1,8 +1,8 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Core;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Commands
{
trunk/src/MyMoney/Presentation/Presenters/income/add_new_income_presenter_specs.cs
@@ -6,9 +6,9 @@ using MyMoney.Domain.Core;
using MyMoney.Presentation.Presenters.income.dto;
using MyMoney.Presentation.Views.income;
using MyMoney.Tasks.application;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.income
{
trunk/src/MyMoney/Presentation/Presenters/Menu/Help/about_the_application_presenter_specs.cs
@@ -1,8 +1,8 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Views.Menu.Help;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Menu.Help
{
trunk/src/MyMoney/Presentation/Presenters/Shell/load_application_shell_specs.cs
@@ -2,9 +2,9 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Core;
using MyMoney.Presentation.Presenters.Commands;
using MyMoney.Presentation.Views.Shell;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Shell
{
trunk/src/MyMoney/Presentation/Presenters/Shell/notification_icon_presenter_specs.cs
@@ -2,9 +2,9 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Infrastructure.eventing;
using MyMoney.Presentation.Resources;
using MyMoney.Presentation.Views.Shell;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Shell
{
trunk/src/MyMoney/Presentation/Presenters/Shell/status_bar_presenter_specs.cs
@@ -1,9 +1,9 @@
using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Resources;
using MyMoney.Presentation.Views.Shell;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Shell
{
trunk/src/MyMoney/Presentation/Presenters/Shell/title_bar_presenter_specs.cs
@@ -3,9 +3,9 @@ using MyMoney.Infrastructure.eventing;
using MyMoney.Presentation.Model.messages;
using MyMoney.Presentation.Model.Projects;
using MyMoney.Presentation.Views.Shell;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Shell
{
trunk/src/MyMoney/Presentation/Presenters/Startup/splash_screen_presenter_specs.cs
@@ -2,9 +2,9 @@ using System;
using jpboodhoo.bdd.contexts;
using MyMoney.Infrastructure.Threading;
using MyMoney.Presentation.Views.Startup;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.Startup
{
trunk/src/MyMoney/Presentation/Presenters/updates/CheckForUpdatesPresenter.cs
@@ -0,0 +1,28 @@
+using MyMoney.Presentation.Core;
+using MyMoney.Presentation.Views.updates;
+using MyMoney.Tasks.infrastructure;
+
+namespace MyMoney.Presentation.Presenters.updates
+{
+ public interface ICheckForUpdatesPresenter : IPresenter
+ {
+ }
+
+ public class CheckForUpdatesPresenter : ICheckForUpdatesPresenter
+ {
+ readonly ICheckForUpdatesView view;
+ readonly IUpdateTasks tasks;
+
+ public CheckForUpdatesPresenter(ICheckForUpdatesView view, IUpdateTasks tasks)
+ {
+ this.view = view;
+ this.tasks = tasks;
+ }
+
+ public void run()
+ {
+ view.attach_to(this);
+ view.display(tasks.current_application_version());
+ }
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Presenters/updates/CheckForUpdatesPresenterSpecs.cs
@@ -0,0 +1,45 @@
+using jpboodhoo.bdd.contexts;
+using MyMoney.Presentation.Model.updates;
+using MyMoney.Presentation.Views.updates;
+using MyMoney.Tasks.infrastructure;
+using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
+
+namespace MyMoney.Presentation.Presenters.updates
+{
+ public class behaves_like_check_for_updates_presenter :
+ concerns_for<ICheckForUpdatesPresenter, CheckForUpdatesPresenter>
+ {
+ public override ICheckForUpdatesPresenter create_sut()
+ {
+ return new CheckForUpdatesPresenter(view, tasks);
+ }
+
+ context c = () =>
+ {
+ view = the_dependency<ICheckForUpdatesView>();
+ tasks = the_dependency<IUpdateTasks>();
+ };
+
+ protected static ICheckForUpdatesView view;
+ protected static IUpdateTasks tasks;
+ }
+
+ public class when_attempting_to_check_for_updates : behaves_like_check_for_updates_presenter
+ {
+ it should_tell_the_view_to_attach_itself_to_the_presenter = () => view.was_told_to(x => x.attach_to(sut));
+
+ it should_tell_the_view_to_display_the_information_on_the_current_version_of_the_application =
+ () => view.was_told_to(x => x.display(version));
+
+ context c = () =>
+ {
+ version = an<ApplicationVersion>();
+ when_the(tasks).is_told_to(x => x.current_application_version()).it_will_return(version);
+ };
+
+ because b = () => sut.run();
+
+ static ApplicationVersion version;
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Presenters/add_company_presenter_specs.cs
@@ -2,9 +2,9 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Presenters.billing.dto;
using MyMoney.Presentation.Views;
using MyMoney.Tasks.application;
-using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
+using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters
{
trunk/src/MyMoney/Presentation/Views/updates/ICheckForUpdatesView.cs
@@ -0,0 +1,11 @@
+using MyMoney.Presentation.Model.updates;
+using MyMoney.Presentation.Presenters.updates;
+using MyMoney.Presentation.Views.core;
+
+namespace MyMoney.Presentation.Views.updates
+{
+ public interface ICheckForUpdatesView : IView<ICheckForUpdatesPresenter>
+ {
+ void display(ApplicationVersion information);
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Tasks/infrastructure/IUpdateTasks.cs
@@ -0,0 +1,9 @@
+using MyMoney.Presentation.Model.updates;
+
+namespace MyMoney.Tasks.infrastructure
+{
+ public interface IUpdateTasks
+ {
+ ApplicationVersion current_application_version();
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/Testing/spechelpers/contexts/concerns_for.cs
@@ -11,17 +11,17 @@ namespace MyMoney.Testing.spechelpers.contexts
{
return item;
}
- }
- public abstract class concerns_for<Contract, Implementation> : concerns_for<Contract>, IHideObjectMembers
- where Implementation : Contract
- {
protected static T dependency<T>() where T : class
{
return MockRepository.GenerateMock<T>();
}
}
+ public abstract class concerns_for<Contract, Implementation> : concerns_for<Contract>, IHideObjectMembers where Implementation : Contract
+ {
+ }
+
public abstract class concerns_for : observations_for_a_static_sut, IHideObjectMembers
{
protected static T dependency<T>() where T : class
trunk/src/MyMoney/Testing/spechelpers/core/mocking_extensions.cs
@@ -1,15 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MyMoney.Testing.Extensions;
using Rhino.Mocks;
using Rhino.Mocks.Interfaces;
-namespace MyMoney.Testing.Extensions
+namespace MyMoney.Testing.spechelpers.core
{
public static class mocking_extensions
{
public static method_call_occurance<T> was_told_to<T>(this T mocked_item,
- Action<T> actionToPerform)
+ Action<T> actionToPerform)
{
return new method_call_occurance<T>(mocked_item, actionToPerform);
}
trunk/src/MyMoney/Utility/Extensions/mapping_extensions_specs.cs
@@ -3,6 +3,7 @@ using MyMoney.Testing.Extensions;
using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
using MyMoney.Utility.Core;
+using mocking_extensions=MyMoney.Testing.spechelpers.core.mocking_extensions;
namespace MyMoney.Utility.Extensions
{
@@ -17,8 +18,8 @@ namespace MyMoney.Utility.Extensions
second_mapper = an<IMapper<string, int>>();
a = 1;
- when_the(first_mapper).is_told_to(x => x.map_from(a)).it_will_return("1");
- when_the(second_mapper).is_told_to(x => x.map_from("1")).it_will_return(1);
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(first_mapper), x => x.map_from(a)), "1");
+ mocking_extensions.it_will_return(mocking_extensions.is_told_to(when_the(second_mapper), x => x.map_from("1")), 1);
};
because b = () => { result = first_mapper.then(second_mapper).map_from(a); };
trunk/src/MyMoney/MyMoney.csproj
@@ -279,6 +279,7 @@
<Compile Include="Presentation\Model\reporting\IReport.cs" />
<Compile Include="Presentation\Model\reporting\report_binding_extensions.cs" />
<Compile Include="Presentation\Model\reporting\report_binding_extensions_specs.cs" />
+ <Compile Include="Presentation\Model\updates\ApplicationVersion.cs" />
<Compile Include="Presentation\Presenters\billing\add_bill_payment_presenter.cs" />
<Compile Include="Presentation\Presenters\add_company_presenter.cs" />
<Compile Include="Presentation\Presenters\add_company_presenter_specs.cs" />
@@ -331,6 +332,8 @@
<Compile Include="Presentation\Presenters\Startup\hide_the_splash_screen.cs" />
<Compile Include="Presentation\Presenters\Startup\ISplashScreenState.cs" />
<Compile Include="Presentation\Presenters\Startup\splash_screen_presenter.cs" />
+ <Compile Include="Presentation\Presenters\updates\CheckForUpdatesPresenter.cs" />
+ <Compile Include="Presentation\Presenters\updates\CheckForUpdatesPresenterSpecs.cs" />
<Compile Include="Presentation\Resources\HybridIcon.cs" />
<Compile Include="Presentation\Views\add_new_company_view.cs">
<SubType>Form</SubType>
@@ -402,10 +405,12 @@
<Compile Include="Presentation\Views\Shell\notification_icon_view.cs" />
<Compile Include="Presentation\Views\Shell\task_tray_message.cs" />
<Compile Include="Presentation\Views\Shell\title_bar.cs" />
+ <Compile Include="Presentation\Views\updates\ICheckForUpdatesView.cs" />
<Compile Include="Tasks\application\billing_tasks.cs" />
<Compile Include="Tasks\application\customer_tasks.cs" />
<Compile Include="Tasks\application\file_system_tasks.cs" />
<Compile Include="Tasks\application\income_tasks.cs" />
+ <Compile Include="Tasks\infrastructure\IUpdateTasks.cs" />
<Compile Include="Testing\spechelpers\contexts\concerns_for.cs" />
<Compile Include="Testing\spechelpers\contexts\behaves_like_a_repository.cs" />
<Compile Include="Testing\spechelpers\core\IHideObjectMembers.cs" />