Commit 0ec9832
Changed files (35)
trunk
product
MoMoney.Domain
Core
MoMoney.DTO
MoMoney.Presentation
Presenters
Views
MoMoney.Service
trunk/product/MoMoney.Domain/Core/range.cs
@@ -9,12 +9,12 @@ namespace MoMoney.Domain.Core
T end_of_range { get; }
}
- public class range<T> : IRange<T> where T : IComparable
+ public class Range<T> : IRange<T> where T : IComparable
{
public T start_of_range { get; private set; }
public T end_of_range { get; private set; }
- public range(T start_of_range, T end_of_range)
+ public Range(T start_of_range, T end_of_range)
{
if (start_of_range.CompareTo(end_of_range) < 0) {
this.start_of_range = start_of_range;
trunk/product/MoMoney.Domain/Core/range_specs.cs
@@ -3,21 +3,21 @@ using Gorilla.Commons.Testing;
namespace MoMoney.Domain.Core
{
- [Concern(typeof (range<int>))]
+ [Concern(typeof (Range<int>))]
public abstract class behaves_like_a_range_from_1_to_10 : concerns_for<IRange<int>>
{
public override IRange<int> create_sut()
{
- return new range<int>(1, 10);
+ return new Range<int>(1, 10);
}
}
- [Concern(typeof (range<int>))]
+ [Concern(typeof (Range<int>))]
public abstract class behaves_like_a_range_from_10_to_1 : concerns_for<IRange<int>>
{
public override IRange<int> create_sut()
{
- return new range<int>(10, 1);
+ return new Range<int>(10, 1);
}
}
trunk/product/MoMoney.DTO/CompanyDTO.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace MoMoney.DTO
+{
+ public class CompanyDTO
+ {
+ public Guid id { get; set; }
+ public string name { get; set; }
+ }
+}
\ No newline at end of file
trunk/product/MoMoney.DTO/income_information_dto.cs → trunk/product/MoMoney.DTO/IncomeInformationDTO.cs
@@ -1,6 +1,6 @@
namespace MoMoney.Presentation.Presenters.income.dto
{
- public class income_information_dto
+ public class IncomeInformationDTO
{
public string company { get; set; }
public string amount { get; set; }
trunk/product/MoMoney.DTO/MoMoney.DTO.csproj
@@ -48,8 +48,9 @@
<Compile Include="AddNewBillDTO.cs" />
<Compile Include="ApplicationVersion.cs" />
<Compile Include="BillInformationDto.cs" />
+ <Compile Include="CompanyDTO.cs" />
<Compile Include="IncomeSubmissionDto.cs" />
- <Compile Include="income_information_dto.cs" />
+ <Compile Include="IncomeInformationDTO.cs" />
<Compile Include="monthly_summary_dto.cs" />
<Compile Include="RegisterNewCompany.cs" />
</ItemGroup>
trunk/product/MoMoney.Presentation/Presenters/Billing/AddBillPaymentPresenter.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Gorilla.Commons.Infrastructure;
-using MoMoney.Domain.accounting.billing;
+using MoMoney.DTO;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.billing;
@@ -26,7 +26,7 @@ namespace MoMoney.Presentation.Presenters.billing
{
view.attach_to(this);
pump
- .run<IEnumerable<ICompany>, IGetAllCompanysQuery>(view)
+ .run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view)
.run<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>(view);
}
trunk/product/MoMoney.Presentation/Presenters/Billing/ViewAllBillsPresenter.cs
@@ -1,4 +1,5 @@
-using Gorilla.Commons.Utility.Extensions;
+using System.Collections.Generic;
+using Gorilla.Commons.Infrastructure;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.billing;
@@ -12,25 +13,17 @@ namespace MoMoney.Presentation.Presenters.billing
public class ViewAllBillsPresenter : ContentPresenter<IViewAllBills>, IViewAllBillsPresenter
{
- readonly IBillingTasks tasks;
+ readonly ICommandPump pump;
- public ViewAllBillsPresenter(IViewAllBills view, IBillingTasks tasks) : base(view)
+ public ViewAllBillsPresenter(IViewAllBills view, ICommandPump pump) : base(view)
{
- this.tasks = tasks;
+ this.pump = pump;
}
public override void run()
{
- view.display(
- tasks
- .all_bills()
- .map_all_using(
- x => new BillInformationDTO
- {
- company_name = x.company_to_pay.name,
- the_amount_owed = x.the_amount_owed.ToString(),
- due_date = x.due_date.to_date_time(),
- }));
+ view.attach_to(this);
+ pump.run<IEnumerable<BillInformationDTO>, IGetAllBillsQuery>(view);
}
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Income/AddNewIncomePresenter.cs
@@ -1,10 +1,10 @@
-using System.Linq;
-using Gorilla.Commons.Utility.Extensions;
-using MoMoney.Domain.accounting.financial_growth;
-using MoMoney.Domain.Core;
+using System.Collections.Generic;
+using Gorilla.Commons.Infrastructure;
+using MoMoney.DTO;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Presenters.income.dto;
using MoMoney.Presentation.Views.income;
+using MoMoney.Service.Application;
using MoMoney.Tasks.application;
namespace MoMoney.Presentation.Presenters.income
@@ -16,49 +16,24 @@ namespace MoMoney.Presentation.Presenters.income
public class AddNewIncomePresenter : ContentPresenter<IAddNewIncomeView>, IAddNewIncomePresenter
{
- readonly IIncomeTasks tasks;
+ readonly ICommandPump pump;
- public AddNewIncomePresenter(IAddNewIncomeView view, IIncomeTasks tasks) : base(view)
+ public AddNewIncomePresenter(IAddNewIncomeView view, ICommandPump pump) : base(view)
{
- this.tasks = tasks;
+ this.pump = pump;
}
public override void run()
{
view.attach_to(this);
- view.display(tasks.all_companys());
- view.display(tasks.retrive_all_income().map_all_using(x => map_from(x)));
+ pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
+ pump.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view);
}
public void submit_new(IncomeSubmissionDto income)
{
- if (similar_income_has_been_submitted(income))
- {
- view.notify("You have already submitted this income");
- }
- tasks.add_new(income);
- view.display(tasks.retrive_all_income().map_all_using(x => map_from(x)));
- }
-
- bool similar_income_has_been_submitted(IncomeSubmissionDto income)
- {
- if (tasks.retrive_all_income().Count() == 0) return false;
- return tasks
- .retrive_all_income()
- .where(x => x.amount_tendered.Equals(income.amount.as_money()))
- .where(x => x.company.id.Equals(income.company_id))
- .where(x => x.date_of_issue.Equals(income.recieved_date.as_a_date()))
- .Count() > 0;
- }
-
- static income_information_dto map_from(IIncome x)
- {
- return new income_information_dto
- {
- amount = x.amount_tendered.to_string(),
- company = x.company.to_string(),
- recieved_date = x.date_of_issue.to_string(),
- };
+ pump.run<IAddNewIncomeCommand, IncomeSubmissionDto>(income);
+ pump.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view);
}
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Income/AddNewIncomePresenterSpecs.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using developwithpassion.bdd.contexts;
+using Gorilla.Commons.Infrastructure;
using Gorilla.Commons.Testing;
-using MoMoney.Domain.accounting.billing;
-using MoMoney.Domain.accounting.financial_growth;
-using MoMoney.Domain.Core;
+using MoMoney.DTO;
using MoMoney.Presentation.Presenters.income.dto;
using MoMoney.Presentation.Views.income;
+using MoMoney.Service.Application;
using MoMoney.Tasks.application;
namespace MoMoney.Presentation.Presenters.income
@@ -17,21 +17,22 @@ namespace MoMoney.Presentation.Presenters.income
context c = () =>
{
view = the_dependency<IAddNewIncomeView>();
- tasks = the_dependency<IIncomeTasks>();
+ pump = the_dependency<ICommandPump>();
};
- protected static IIncomeTasks tasks;
+ protected static ICommandPump pump;
protected static IAddNewIncomeView view;
}
public class when_depositing_new_income_from_a_company : behaves_like_add_new_income_presenter
{
- it should_add_the_income_to_the_account_holders_account = () => tasks.was_told_to(x => x.add_new(income));
+ it should_add_the_income_to_the_account_holders_account = () => pump.was_told_to(x => x.run<IAddNewIncomeCommand, IncomeSubmissionDto>(income));
+
+ it should_display_the_new_income = () => pump.was_told_to(x => x.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view));
context c = () =>
{
income = new IncomeSubmissionDto {};
- when_the(tasks).is_told_to(x => x.retrive_all_income()).it_will_return_nothing();
};
because b = () => sut.submit_new(income);
@@ -39,52 +40,18 @@ namespace MoMoney.Presentation.Presenters.income
static IncomeSubmissionDto income;
}
- public class when_loading_the_add_new_income_screen : behaves_like_add_new_income_presenter
+ [Concern(typeof (AddNewIncomePresenter))]
+ public class when_loaded : behaves_like_add_new_income_presenter
{
- it should_display_a_list_of_all_the_registered_company_to_select = () => view.was_told_to( x => x.display(companys));
+ it should_display_a_list_of_all_the_registered_company_to_select = () => pump.was_told_to(x => x.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view));
it should_bind_a_presenter_to_the_screen = () => view.was_told_to(x => x.attach_to(sut));
- context c = () =>
- {
- companys = new List<ICompany>();
- tasks.is_told_to(x => x.all_companys()).it_will_return(companys);
- };
+ it should_display_the_income_already_added = () => pump.was_told_to(x => x.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view));
- because b = () => sut.run();
+ context c = () => { };
- static List<ICompany> companys;
+ because b = () => sut.run();
}
- [Concern(typeof (AddNewIncomePresenter))]
- public class when_attempting_to_submit_the_same_income_more_than_once : behaves_like_add_new_income_presenter
- {
- it should_inform_you_that_you_have_already_added_it =
- () => view.was_told_to(x => x.notify("You have already submitted this income"));
-
- context c = () =>
- {
- var a_company = an<ICompany>();
- var matching_income = an<IIncome>();
- var today = new Date(2008, 12, 26);
- var id = Guid.NewGuid();
-
- income = new IncomeSubmissionDto
- {
- amount = 100.00,
- company_id = id,
- recieved_date = today,
- };
-
- when_the(matching_income).is_asked_for(x => x.amount_tendered).it_will_return(100.as_money());
- when_the(matching_income).is_asked_for(x => x.company).it_will_return(a_company);
- when_the(matching_income).is_asked_for(x => x.date_of_issue).it_will_return(today);
- when_the(a_company).is_asked_for(x => x.id).it_will_return(id);
- when_the(tasks).is_told_to(x => x.retrive_all_income()).it_will_return(matching_income);
- };
-
- because b = () => sut.submit_new(income);
-
- static IncomeSubmissionDto income;
- }
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Income/ViewIncomeHistoryPresenter.cs
@@ -1,9 +1,9 @@
-using Gorilla.Commons.Utility.Extensions;
-using MoMoney.Domain.accounting.financial_growth;
+using System.Collections.Generic;
+using Gorilla.Commons.Infrastructure;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Presenters.income.dto;
using MoMoney.Presentation.Views.income;
-using MoMoney.Tasks.application;
+using MoMoney.Service.Application;
namespace MoMoney.Presentation.Presenters.income
{
@@ -13,26 +13,17 @@ namespace MoMoney.Presentation.Presenters.income
public class ViewIncomeHistoryPresenter : ContentPresenter<IViewIncomeHistory>, IViewIncomeHistoryPresenter
{
- readonly IIncomeTasks tasks;
+ readonly ICommandPump pump;
- public ViewIncomeHistoryPresenter(IViewIncomeHistory view, IIncomeTasks tasks) : base(view)
+ public ViewIncomeHistoryPresenter(IViewIncomeHistory view, ICommandPump pump) : base(view)
{
- this.tasks = tasks;
+ this.pump = pump;
}
public override void run()
{
- view.display(tasks.retrive_all_income().map_all_using(x => map_from(x)));
- }
-
- income_information_dto map_from(IIncome x)
- {
- return new income_information_dto
- {
- amount = x.amount_tendered.ToString(),
- company = x.company.ToString(),
- recieved_date = x.date_of_issue.ToString(),
- };
+ view.attach_to(this);
+ pump.run<IEnumerable<IncomeInformationDTO>, IGetAllIncomeQuery>(view);
}
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Reporting/ReportPresenter.cs
@@ -1,7 +1,4 @@
-using Gorilla.Commons.Utility.Extensions;
-using MoMoney.Domain.accounting.billing;
using MoMoney.Presentation.Core;
-using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.billing;
using MoMoney.Presentation.Views.reporting;
using MoMoney.Tasks.application;
@@ -15,28 +12,18 @@ namespace MoMoney.Presentation.Presenters.reporting
public class ReportPresenter : ContentPresenter<IReportViewer>, IViewAllBillsReportPresenter
{
readonly IViewAllBillsReport report;
- readonly IBillingTasks tasks;
+ readonly IGetAllBillsQuery query;
- public ReportPresenter(IReportViewer view, IViewAllBillsReport report, IBillingTasks tasks) : base(view)
+ public ReportPresenter(IReportViewer view, IViewAllBillsReport report, IGetAllBillsQuery query) : base(view)
{
- this.tasks = tasks;
this.report = report;
+ this.query = query;
}
public override void run()
{
- report.bind_to(tasks.all_bills().map_all_using(x => map_from(x)));
+ report.run(query.fetch());
view.display(report);
}
-
- BillInformationDTO map_from(IBill x)
- {
- return new BillInformationDTO
- {
- company_name = x.company_to_pay.name,
- due_date = x.due_date.to_date_time(),
- the_amount_owed = x.the_amount_owed.to_string()
- };
- }
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Updates/CheckForUpdatesPresenter.cs
@@ -1,4 +1,5 @@
using Gorilla.Commons.Infrastructure;
+using Gorilla.Commons.Infrastructure.Logging;
using Gorilla.Commons.Utility.Core;
using MoMoney.Domain.Core;
using MoMoney.Presentation.Core;
@@ -21,22 +22,12 @@ namespace MoMoney.Presentation.Presenters.updates
public class CheckForUpdatesPresenter : ICheckForUpdatesPresenter
{
readonly ICheckForUpdatesView view;
- readonly IRestartCommand command;
- readonly IDownloadTheLatestVersion download_the_latest;
- readonly ICancelUpdate cancel_requested_update;
readonly ICommandPump pump;
- public CheckForUpdatesPresenter(ICheckForUpdatesView view,
- ICommandPump pump,
- IRestartCommand command,
- IDownloadTheLatestVersion download_the_latest,
- ICancelUpdate cancel_requested_update)
+ public CheckForUpdatesPresenter(ICheckForUpdatesView view, ICommandPump pump)
{
this.pump = pump;
this.view = view;
- this.cancel_requested_update = cancel_requested_update;
- this.download_the_latest = download_the_latest;
- this.command = command;
}
public void run()
@@ -48,18 +39,18 @@ namespace MoMoney.Presentation.Presenters.updates
public void begin_update()
{
- download_the_latest.run(this);
+ pump.run<IDownloadTheLatestVersion, ICallback<Percent>>(this);
}
public void cancel_update()
{
- cancel_requested_update.run();
+ pump.run<ICancelUpdate>();
view.close();
}
public void restart()
{
- command.run();
+ pump.run<IRestartCommand>();
}
public void do_not_update()
@@ -71,10 +62,15 @@ namespace MoMoney.Presentation.Presenters.updates
{
if (completed.Equals(new Percent(100)))
{
+ this.log().debug("completed download");
view.update_complete();
restart();
}
- else view.downloaded(completed);
+ else
+ {
+ this.log().debug("completed {0}", completed);
+ view.downloaded(completed);
+ }
}
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Presenters/Updates/CheckForUpdatesPresenterSpecs.cs
@@ -1,6 +1,8 @@
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Infrastructure;
using Gorilla.Commons.Testing;
+using Gorilla.Commons.Utility.Core;
+using MoMoney.Domain.Core;
using MoMoney.Presentation.Model.updates;
using MoMoney.Presentation.Presenters.Commands;
using MoMoney.Presentation.Views.updates;
@@ -16,17 +18,11 @@ namespace MoMoney.Presentation.Presenters.updates
context c = () =>
{
view = the_dependency<ICheckForUpdatesView>();
- command = the_dependency<IRestartCommand>();
- download_the_latest = the_dependency<IDownloadTheLatestVersion>();
pump = the_dependency<ICommandPump>();
- cancel_update = the_dependency<ICancelUpdate>();
};
- protected static ICheckForUpdatesView view;
- protected static IRestartCommand command;
- protected static IDownloadTheLatestVersion download_the_latest;
- protected static ICancelUpdate cancel_update;
- protected static ICommandPump pump;
+ static protected ICheckForUpdatesView view;
+ static protected ICommandPump pump;
}
public class when_attempting_to_check_for_updates : behaves_like_check_for_updates_presenter
@@ -36,7 +32,8 @@ namespace MoMoney.Presentation.Presenters.updates
it should_tell_the_view_to_display_the_information_on_the_current_version_of_the_application =
() => view.was_told_to(x => x.display());
- it should_go_and_find_out_what_the_latest_version_is = () => pump.was_told_to(x => x.run<ApplicationVersion, IWhatIsTheAvailableVersion>(view));
+ it should_go_and_find_out_what_the_latest_version_is =
+ () => pump.was_told_to(x => x.run<ApplicationVersion, IWhatIsTheAvailableVersion>(view));
because b = () => sut.run();
}
@@ -44,7 +41,7 @@ namespace MoMoney.Presentation.Presenters.updates
public class when_initiating_an_update_and_one_is_available : behaves_like_check_for_updates_presenter
{
it should_start_downloading_the_latest_version_of_the_application =
- () => download_the_latest.was_told_to(x => x.run(sut));
+ () => pump.was_told_to(x => x.run<IDownloadTheLatestVersion, ICallback<Percent>>(sut));
because b = () => sut.begin_update();
}
@@ -65,7 +62,7 @@ namespace MoMoney.Presentation.Presenters.updates
public class when_an_update_is_cancelled : behaves_like_check_for_updates_presenter
{
- it should_stop_downloading_the_latest_update = () => cancel_update.was_told_to(x => x.run());
+ it should_stop_downloading_the_latest_update = () => pump.was_told_to(x => x.run<ICancelUpdate>());
because b = () => sut.cancel_update();
}
@@ -73,7 +70,7 @@ namespace MoMoney.Presentation.Presenters.updates
public class when_an_update_is_complete_and_the_user_agrees_to_restart_the_application :
behaves_like_check_for_updates_presenter
{
- it should_restart_the_application = () => command.run();
+ it should_restart_the_application = () => pump.was_told_to(x => x.run<IRestartCommand>());
because b = () => sut.restart();
}
trunk/product/MoMoney.Presentation/Presenters/AddCompanyPresenter.cs
@@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq;
using Gorilla.Commons.Infrastructure;
using Gorilla.Commons.Utility.Extensions;
-using MoMoney.Domain.accounting.billing;
using MoMoney.DTO;
using MoMoney.Presentation.Core;
using MoMoney.Presentation.Views;
@@ -30,7 +29,7 @@ namespace MoMoney.Presentation.Presenters
public override void run()
{
view.attach_to(this);
- pump.run<IEnumerable<ICompany>, IGetAllCompanysQuery>(view);
+ pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
}
public void submit(RegisterNewCompany dto)
@@ -40,7 +39,7 @@ namespace MoMoney.Presentation.Presenters
else
pump
.run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto)
- .run<IEnumerable<ICompany>, IGetAllCompanysQuery>(view);
+ .run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
}
bool company_has_already_been_registered(RegisterNewCompany dto)
trunk/product/MoMoney.Presentation/Views/Billing/AddBillPaymentView.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using Gorilla.Commons.Utility.Extensions;
using Gorilla.Commons.Windows.Forms;
using Gorilla.Commons.Windows.Forms.Krypton;
-using MoMoney.Domain.accounting.billing;
+using MoMoney.DTO;
using MoMoney.Presentation.Presenters.billing;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.core;
@@ -26,7 +26,7 @@ namespace MoMoney.Presentation.Views.billing
submit_clicked = x => presenter.submit_bill_payment(create_dto());
}
- public void run(IEnumerable<ICompany> companys)
+ public void run(IEnumerable<CompanyDTO> companys)
{
ux_company_names.bind_to(companys);
}
trunk/product/MoMoney.Presentation/Views/Billing/IAddBillPaymentView.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Gorilla.Commons.Utility.Core;
-using MoMoney.Domain.accounting.billing;
+using MoMoney.DTO;
using MoMoney.Presentation.Presenters.billing;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.core;
@@ -9,7 +9,7 @@ namespace MoMoney.Presentation.Views.billing
{
public interface IAddBillPaymentView : IDockedContentView,
IView<IAddBillPaymentPresenter>,
- ICallback<IEnumerable<ICompany>>,
+ ICallback<IEnumerable<CompanyDTO>>,
ICallback<IEnumerable<BillInformationDTO>>
{
}
trunk/product/MoMoney.Presentation/Views/Billing/IViewAllBills.cs
@@ -1,11 +1,14 @@
using System.Collections.Generic;
+using Gorilla.Commons.Utility.Core;
+using MoMoney.Presentation.Presenters.billing;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.core;
namespace MoMoney.Presentation.Views.billing
{
- public interface IViewAllBills : IDockedContentView
+ public interface IViewAllBills : IDockedContentView,
+ IView<IViewAllBillsPresenter>,
+ ICallback<IEnumerable<BillInformationDTO>>
{
- void display(IEnumerable<BillInformationDTO> bills);
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Views/Billing/view_all_bills_report.cs
@@ -9,7 +9,7 @@ namespace MoMoney.Presentation.Views.billing
{
public interface IViewAllBillsReport : IReport
{
- void bind_to(IEnumerable<BillInformationDTO> bills);
+ void run(IEnumerable<BillInformationDTO> bills);
}
public partial class view_all_bills_report : ActiveReport3, IViewAllBillsReport
@@ -22,7 +22,7 @@ namespace MoMoney.Presentation.Views.billing
public string name { get; private set; }
- public void bind_to(IEnumerable<BillInformationDTO> bills)
+ public void run(IEnumerable<BillInformationDTO> bills)
{
ux_company_name.bind_to<BillInformationDTO, string>(x => x.company_name);
ux_amount.bind_to<BillInformationDTO, string>(x => x.the_amount_owed);
trunk/product/MoMoney.Presentation/Views/Billing/ViewAllBills.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using MoMoney.Presentation.Presenters.billing;
using MoMoney.Presentation.Presenters.billing.dto;
using MoMoney.Presentation.Views.core;
@@ -13,7 +14,11 @@ namespace MoMoney.Presentation.Views.billing
titled("View Bills");
}
- public void display(IEnumerable<BillInformationDTO> bills)
+ public void attach_to(IViewAllBillsPresenter presenter)
+ {
+ }
+
+ public void run(IEnumerable<BillInformationDTO> bills)
{
ux_bills.DataSource = bills.ToList();
}
trunk/product/MoMoney.Presentation/Views/Income/AddNewIncomeView.cs
@@ -5,7 +5,7 @@ using System.Windows.Forms;
using Gorilla.Commons.Utility.Extensions;
using Gorilla.Commons.Windows.Forms;
using Gorilla.Commons.Windows.Forms.Krypton;
-using MoMoney.Domain.accounting.billing;
+using MoMoney.DTO;
using MoMoney.Presentation.Model.interaction;
using MoMoney.Presentation.Presenters.income;
using MoMoney.Presentation.Presenters.income.dto;
@@ -29,12 +29,12 @@ namespace MoMoney.Presentation.Views.income
submit_button = x => presenter.submit_new(create_income());
}
- public void display(IEnumerable<ICompany> companies)
+ public void run(IEnumerable<CompanyDTO> companies)
{
ux_companys.bind_to(companies);
}
- public void display(IEnumerable<income_information_dto> incomes)
+ public void run(IEnumerable<IncomeInformationDTO> incomes)
{
ux_income_received_grid.DataSource = incomes.databind();
}
@@ -50,7 +50,7 @@ namespace MoMoney.Presentation.Views.income
{
return new IncomeSubmissionDto
{
- company_id = ux_companys.SelectedItem.downcast_to<ICompany>().id,
+ company_id = ux_companys.SelectedItem.downcast_to<CompanyDTO>().id,
amount = ux_amount.Text.to_double(),
recieved_date = ux_date_received.Value
};
trunk/product/MoMoney.Presentation/Views/Income/IAddNewIncomeView.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
-using MoMoney.Domain.accounting.billing;
+using Gorilla.Commons.Utility.Core;
+using MoMoney.DTO;
using MoMoney.Presentation.Model.interaction;
using MoMoney.Presentation.Presenters.income;
using MoMoney.Presentation.Presenters.income.dto;
@@ -7,9 +8,9 @@ using MoMoney.Presentation.Views.core;
namespace MoMoney.Presentation.Views.income
{
- public interface IAddNewIncomeView : IDockedContentView, IView<IAddNewIncomePresenter>, INotification
+ public interface IAddNewIncomeView : IDockedContentView, IView<IAddNewIncomePresenter>, INotification,
+ ICallback<IEnumerable<CompanyDTO>>,
+ ICallback<IEnumerable<IncomeInformationDTO>>
{
- void display(IEnumerable<ICompany> companys);
- void display(IEnumerable<income_information_dto> incomes);
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Views/Income/IViewIncomeHistory.cs
@@ -1,11 +1,15 @@
using System.Collections.Generic;
+using Gorilla.Commons.Utility.Core;
+using MoMoney.Presentation.Presenters.income;
using MoMoney.Presentation.Presenters.income.dto;
using MoMoney.Presentation.Views.core;
namespace MoMoney.Presentation.Views.income
{
- public interface IViewIncomeHistory : IDockedContentView
+ public interface IViewIncomeHistory : IDockedContentView,
+ IView<IViewIncomeHistoryPresenter>,
+ ICallback<IEnumerable<IncomeInformationDTO>>
+
{
- void display(IEnumerable<income_information_dto> summary);
}
}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Views/Income/ViewAllIncome.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Gorilla.Commons.Utility.Extensions;
+using MoMoney.Presentation.Presenters.income;
using MoMoney.Presentation.Presenters.income.dto;
using MoMoney.Presentation.Views.core;
@@ -13,7 +14,11 @@ namespace MoMoney.Presentation.Views.income
titled("View All Income");
}
- public void display(IEnumerable<income_information_dto> summary)
+ public void attach_to(IViewIncomeHistoryPresenter presenter)
+ {
+ }
+
+ public void run(IEnumerable<IncomeInformationDTO> summary)
{
ux_view_all_income.DataSource = summary.databind();
}
trunk/product/MoMoney.Presentation/Views/Reporting/ReportViewer.cs
@@ -1,4 +1,5 @@
-using DataDynamics.ActiveReports;
+using System;
+using DataDynamics.ActiveReports;
using Gorilla.Commons.Utility.Extensions;
using MoMoney.Presentation.Model.reporting;
using MoMoney.Presentation.Views.core;
trunk/product/MoMoney.Presentation/Views/AddCompanyView.cs
@@ -6,7 +6,6 @@ using System.Windows.Forms;
using Gorilla.Commons.Utility.Extensions;
using Gorilla.Commons.Windows.Forms;
using Gorilla.Commons.Windows.Forms.Databinding;
-using MoMoney.Domain.accounting.billing;
using MoMoney.DTO;
using MoMoney.Presentation.Model.interaction;
using MoMoney.Presentation.Presenters;
@@ -41,7 +40,7 @@ namespace MoMoney.Presentation.Views
submit_button = x => presenter.submit(dto);
}
- public void run(IEnumerable<ICompany> companies)
+ public void run(IEnumerable<CompanyDTO> companies)
{
ux_companys_listing.DataSource = companies.databind();
trunk/product/MoMoney.Presentation/Views/IAddCompanyView.cs
@@ -1,13 +1,14 @@
using System.Collections.Generic;
using Gorilla.Commons.Utility.Core;
-using MoMoney.Domain.accounting.billing;
+using MoMoney.DTO;
using MoMoney.Presentation.Model.interaction;
using MoMoney.Presentation.Presenters;
using MoMoney.Presentation.Views.core;
namespace MoMoney.Presentation.Views
{
- public interface IAddCompanyView : IDockedContentView, INotification, IView<IAddCompanyPresenter>, ICallback<IEnumerable<ICompany>>
+ public interface IAddCompanyView : IDockedContentView, INotification, IView<IAddCompanyPresenter>,
+ ICallback<IEnumerable<CompanyDTO>>
{
//void run(IEnumerable<ICompany> companies);
}
trunk/product/MoMoney.Presentation/MoMoney.Presentation.csproj
@@ -96,8 +96,6 @@
<Compile Include="Core\PresenterRegistry.cs" />
<Compile Include="IModule.cs" />
<Compile Include="Model\FileSystem\folder.cs" />
- <Compile Include="Model\Interaction\INotification.cs" />
- <Compile Include="Model\Interaction\notification_message.cs" />
<Compile Include="Model\Menu\create.cs" />
<Compile Include="Model\Menu\File\CloseProjectCommand.cs" />
<Compile Include="Model\Menu\File\CloseWindowCommand.cs" />
@@ -464,6 +462,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <Folder Include="Model\Interaction\" />
<Folder Include="Model\Keyboard\" />
<Folder Include="Properties\" />
<Folder Include="Views\Helpers\" />
trunk/product/MoMoney.Service/Application/AddNewIncomeCommand.cs
@@ -0,0 +1,46 @@
+using System.Linq;
+using Gorilla.Commons.Utility.Core;
+using Gorilla.Commons.Utility.Extensions;
+using MoMoney.Domain.Core;
+using MoMoney.Presentation.Model.interaction;
+using MoMoney.Presentation.Presenters.income.dto;
+using MoMoney.Tasks.application;
+
+namespace MoMoney.Service.Application
+{
+ public interface IAddNewIncomeCommand : IParameterizedCommand<IncomeSubmissionDto>
+ {
+ }
+
+ public class AddNewIncomeCommand : IAddNewIncomeCommand
+ {
+ readonly IIncomeTasks tasks;
+ readonly INotification notification;
+
+ public AddNewIncomeCommand(IIncomeTasks tasks, INotification notification)
+ {
+ this.tasks = tasks;
+ this.notification = notification;
+ }
+
+ public void run(IncomeSubmissionDto item)
+ {
+ if (similar_income_has_been_submitted(item))
+ {
+ notification.notify("You have already submitted this income");
+ }
+ tasks.add_new(item);
+ }
+
+ bool similar_income_has_been_submitted(IncomeSubmissionDto income)
+ {
+ if (tasks.retrive_all_income().Count() == 0) return false;
+ return tasks
+ .retrive_all_income()
+ .where(x => x.amount_tendered.Equals(income.amount.as_money()))
+ .where(x => x.company.id.Equals(income.company_id))
+ .where(x => x.date_of_issue.Equals(income.recieved_date.as_a_date()))
+ .Count() > 0;
+ }
+ }
+}
\ No newline at end of file
trunk/product/MoMoney.Service/Application/AddNewIncomeCommandSpecs.cs
@@ -0,0 +1,61 @@
+using System;
+using developwithpassion.bdd.contexts;
+using Gorilla.Commons.Testing;
+using MoMoney.Domain.accounting.billing;
+using MoMoney.Domain.accounting.financial_growth;
+using MoMoney.Domain.Core;
+using MoMoney.Presentation.Model.interaction;
+using MoMoney.Presentation.Presenters.income.dto;
+using MoMoney.Tasks.application;
+
+namespace MoMoney.Service.Application
+{
+ public class AddNewIncomeCommandSpecs
+ {
+ }
+
+ [Concern(typeof (AddNewIncomeCommand))]
+ public abstract class when_adding_a_new_income : concerns_for<IAddNewIncomeCommand, AddNewIncomeCommand>
+ {
+ context c = () =>
+ {
+ notification = the_dependency<INotification>();
+ tasks = the_dependency<IIncomeTasks>();
+ };
+
+ static protected INotification notification;
+ static protected IIncomeTasks tasks;
+ }
+
+ [Concern(typeof (AddNewIncomeCommand))]
+ public class when_the_same_income_has_already_been_added : when_adding_a_new_income
+ {
+ it should_inform_you_that_you_have_already_added_it =
+ () => notification.was_told_to(x => x.notify("You have already submitted this income"));
+
+ context c = () =>
+ {
+ var a_company = an<ICompany>();
+ var matching_income = an<IIncome>();
+ var today = new Date(2008, 12, 26);
+ var id = Guid.NewGuid();
+
+ income = new IncomeSubmissionDto
+ {
+ amount = 100.00,
+ company_id = id,
+ recieved_date = today,
+ };
+
+ when_the(matching_income).is_asked_for(x => x.amount_tendered).it_will_return(100.as_money());
+ when_the(matching_income).is_asked_for(x => x.company).it_will_return(a_company);
+ when_the(matching_income).is_asked_for(x => x.date_of_issue).it_will_return(today);
+ when_the(a_company).is_asked_for(x => x.id).it_will_return(id);
+ when_the(tasks).is_told_to(x => x.retrive_all_income()).it_will_return(matching_income);
+ };
+
+ because b = () => sut.run(income);
+
+ static IncomeSubmissionDto income;
+ }
+}
\ No newline at end of file
trunk/product/MoMoney.Service/Application/GetAllCompanysQuery.cs
@@ -1,11 +1,12 @@
using System.Collections.Generic;
using Gorilla.Commons.Utility.Core;
-using MoMoney.Domain.accounting.billing;
+using Gorilla.Commons.Utility.Extensions;
using MoMoney.Domain.repositories;
+using MoMoney.DTO;
namespace MoMoney.Tasks.application
{
- public interface IGetAllCompanysQuery : IQuery<IEnumerable<ICompany>>
+ public interface IGetAllCompanysQuery : IQuery<IEnumerable<CompanyDTO>>
{
}
@@ -18,9 +19,9 @@ namespace MoMoney.Tasks.application
this.companys = companys;
}
- public IEnumerable<ICompany> fetch()
+ public IEnumerable<CompanyDTO> fetch()
{
- return companys.all();
+ return companys.all().map_all_using(x => new CompanyDTO {id = x.id, name = x.name});
}
}
}
\ No newline at end of file
trunk/product/MoMoney.Service/Application/GetAllIncomeQuery.cs
@@ -0,0 +1,38 @@
+using System.Collections.Generic;
+using Gorilla.Commons.Utility.Core;
+using Gorilla.Commons.Utility.Extensions;
+using MoMoney.Domain.accounting.financial_growth;
+using MoMoney.Presentation.Presenters.income.dto;
+using MoMoney.Tasks.application;
+
+namespace MoMoney.Service.Application
+{
+ public interface IGetAllIncomeQuery : IQuery<IEnumerable<IncomeInformationDTO>>
+ {
+ }
+
+ public class GetAllIncomeQuery : IGetAllIncomeQuery
+ {
+ readonly IIncomeTasks tasks;
+
+ public GetAllIncomeQuery(IIncomeTasks tasks)
+ {
+ this.tasks = tasks;
+ }
+
+ public IEnumerable<IncomeInformationDTO> fetch()
+ {
+ return tasks.retrive_all_income().map_all_using(x => map_from(x));
+ }
+
+ static IncomeInformationDTO map_from(IIncome x)
+ {
+ return new IncomeInformationDTO
+ {
+ amount = x.amount_tendered.to_string(),
+ company = x.company.to_string(),
+ recieved_date = x.date_of_issue.to_string(),
+ };
+ }
+ }
+}
\ No newline at end of file
trunk/product/MoMoney.Presentation/Model/Interaction/INotification.cs → trunk/product/MoMoney.Service/Application/INotification.cs
File renamed without changes
trunk/product/MoMoney.Presentation/Model/Interaction/notification_message.cs → trunk/product/MoMoney.Service/Application/notification_message.cs
File renamed without changes
trunk/product/MoMoney.Service/Infrastructure/Updating/DownloadTheLatestVersion.cs
@@ -1,8 +1,9 @@
using Gorilla.Commons.Infrastructure;
using Gorilla.Commons.Utility.Core;
using MoMoney.Domain.Core;
+using MoMoney.Tasks.infrastructure.updating;
-namespace MoMoney.Tasks.infrastructure.updating
+namespace MoMoney.Service.Infrastructure.Updating
{
public interface IDownloadTheLatestVersion : ICallbackCommand<Percent>
{
trunk/product/MoMoney.Service/MoMoney.Service.csproj
@@ -31,10 +31,18 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="bdddoc, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\build\lib\test\bdd.doc\bdddoc.dll</HintPath>
+ </Reference>
<Reference Include="developwithpassion.bdd, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\test\developwithpassion\developwithpassion.bdd.dll</HintPath>
</Reference>
+ <Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\build\lib\test\rhino.mocks\Rhino.Mocks.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -50,11 +58,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Application\AddNewIncomeCommand.cs" />
+ <Compile Include="Application\AddNewIncomeCommandSpecs.cs" />
<Compile Include="Application\BillingTasks.cs" />
<Compile Include="Application\CustomerTasks.cs" />
<Compile Include="Application\GetAllBillsQuery.cs" />
<Compile Include="Application\GetAllCompanysQuery.cs" />
+ <Compile Include="Application\GetAllIncomeQuery.cs" />
<Compile Include="Application\IncomeTasks.cs" />
+ <Compile Include="Application\INotification.cs" />
+ <Compile Include="Application\notification_message.cs" />
<Compile Include="Application\RegisterNewCompanyCommand.cs" />
<Compile Include="Application\SaveNewBillCommand.cs" />
<Compile Include="Infrastructure\Logging\LogFileTasks.cs" />