Commit b01eb2a
Changed files (3)
product
database
transactions
Domain
Accounting
Presentation
product/database/transactions/SessionSpecs.cs
@@ -128,8 +128,8 @@ namespace momoney.database.transactions
wrong_item = an<ITestEntity>();
correct_item = an<ITestEntity>();
map = an<IIdentityMap<Guid, ITestEntity>>();
- when_the(wrong_item).is_told_to(x => x.id).it_will_return(Guid.NewGuid());
- when_the(correct_item).is_told_to(x => x.id).it_will_return(id);
+ when_the(wrong_item).is_told_to(x => x.id).it_will_return<Id<Guid>>(Guid.NewGuid());
+ when_the(correct_item).is_told_to(x => x.id).it_will_return<Id<Guid>>(id);
when_the(database)
.is_told_to(x => x.fetch_all<ITestEntity>())
.it_will_return(wrong_item, correct_item);
product/Domain/Accounting/AccountHolderSpecs.cs
@@ -2,25 +2,28 @@ using System;
using System.Collections.Generic;
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;
+using Gorilla.Commons.Utility;
using MoMoney.Domain.Accounting;
using MoMoney.Domain.Core;
namespace MoMoney.Domain.accounting
{
- [Concern(typeof (AccountHolder))]
- public abstract class behaves_like_an_account_holder : concerns_for<IAccountHolder, AccountHolder>
+ public class AccountHolderSpecs
{
- }
+ [Concern(typeof (AccountHolder))]
+ public abstract class behaves_like_an_account_holder : concerns_for<IAccountHolder, AccountHolder>
+ {
+ }
- public class when_a_customer_is_checking_for_any_bills_that_have_not_been_paid : behaves_like_an_account_holder
- {
- it should_return_all_the_unpaid_bills = () =>
+ public class when_a_customer_is_checking_for_any_bills_that_have_not_been_paid : behaves_like_an_account_holder
+ {
+ it should_return_all_the_unpaid_bills = () =>
{
result.should_contain(first_unpaid_bill);
result.should_contain(second_unpaid_bill);
};
- context c = () =>
+ context c = () =>
{
first_unpaid_bill = an<IBill>();
second_unpaid_bill = an<IBill>();
@@ -31,7 +34,7 @@ namespace MoMoney.Domain.accounting
paid_bill.is_told_to(x => x.is_paid_for()).it_will_return(true);
};
- because b = () =>
+ because b = () =>
{
sut.receive(first_unpaid_bill);
sut.receive(paid_bill);
@@ -39,33 +42,32 @@ namespace MoMoney.Domain.accounting
result = sut.collect_all_the_unpaid_bills();
};
- static IEnumerable<IBill> result;
- static IBill first_unpaid_bill;
- static IBill second_unpaid_bill;
- static IBill paid_bill;
- }
+ static IEnumerable<IBill> result;
+ static IBill first_unpaid_bill;
+ static IBill second_unpaid_bill;
+ static IBill paid_bill;
+ }
- [Concern(typeof (AccountHolder))]
- public class when_an_account_holder_is_calculating_their_income_for_a_year : behaves_like_an_account_holder
- {
- context c = () =>
+ [Concern(typeof (AccountHolder))]
+ public class when_an_account_holder_is_calculating_their_income_for_a_year : behaves_like_an_account_holder
+ {
+ context c = () =>
{
income_for_january_2007 = an<IIncome>();
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));
+ income_for_january_2007.is_told_to(x => x.date_of_issue).it_will_return<Date>(new DateTime(2007, 01, 01));
income_for_january_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
- income_for_february_2007.is_told_to(x => x.date_of_issue).it_will_return( new DateTime(2007, 02, 01));
- income_for_february_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000,
- 00));
+ income_for_february_2007.is_told_to(x => x.date_of_issue).it_will_return<Date>(new DateTime(2007, 02, 01));
+ income_for_february_2007.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
- income_for_february_2008.is_told_to(x => x.date_of_issue).it_will_return( new DateTime(2008, 02, 01));
+ income_for_february_2008.is_told_to(x => x.date_of_issue).it_will_return<Date>(new DateTime(2008, 02, 01));
income_for_february_2008.is_told_to(x => x.amount_tendered).it_will_return(new Money(1000, 00));
};
- because b = () =>
+ because b = () =>
{
sut.receive(income_for_january_2007);
sut.receive(income_for_february_2007);
@@ -73,11 +75,12 @@ namespace MoMoney.Domain.accounting
result = sut.calculate_income_for(2007);
};
- it should_return_the_correct_amount = () => result.should_be_equal_to(2000.as_money());
+ it should_return_the_correct_amount = () => result.should_be_equal_to(2000.as_money());
- static Money result;
- static IIncome income_for_january_2007;
- static IIncome income_for_february_2007;
- static IIncome income_for_february_2008;
+ static Money result;
+ static IIncome income_for_january_2007;
+ static IIncome income_for_february_2007;
+ static IIncome income_for_february_2008;
+ }
}
}
\ No newline at end of file
product/Presentation/Core/ApplicationControllerSpecs.cs
@@ -11,12 +11,12 @@ namespace MoMoney.Presentation.Core
{
context c = () =>
{
- presenter_registry = the_dependency<IPresenterRegistry>();
+ presenter_factory = the_dependency<PresenterFactory>();
shell = the_dependency<IShell>();
};
static protected IShell shell;
- static protected IPresenterRegistry presenter_registry;
+ static protected PresenterFactory presenter_factory;
}
public class when_the_application_controller_is_asked_to_run_a_presenter : behaves_like_an_application_controller
@@ -24,16 +24,13 @@ namespace MoMoney.Presentation.Core
context c = () =>
{
implementation_of_the_presenter = an<IPresenter>();
- presenter_registry
- .is_told_to(r => r.all())
+ presenter_factory
+ .is_told_to(r => r.create<IPresenter>())
.it_will_return(implementation_of_the_presenter);
};
because b = () => sut.run<IPresenter>();
- it should_ask_the_registered_presenters_for_an_instance_of_the_presenter_to_run =
- () => presenter_registry.was_told_to(r => r.all());
-
it should_initialize_the_presenter_to_run = () => implementation_of_the_presenter.was_told_to(p => p.present());
static IPresenter implementation_of_the_presenter;
@@ -48,7 +45,7 @@ namespace MoMoney.Presentation.Core
view = an<IDockedContentView>();
var presenter = an<IContentPresenter>();
- presenter_registry.is_told_to(r => r.all()).it_will_return(presenter);
+ presenter_factory.is_told_to(r => r.create<IContentPresenter>()).it_will_return(presenter);
presenter.is_told_to(x => x.View).it_will_return(view);
};