From 3d31d52493f79b3262d4a860d621dea20109f88e Mon Sep 17 00:00:00 2001 From: mgroves Date: Sat, 2 Apr 2011 00:19:55 -0400 Subject: [PATCH] reorganized tests, fixed ticker validation (thanks to monkey), other minor cleanup --- ...noDroid.LumenWorks.Framework.IO.Csv.csproj | 2 + .../StockData/YahooStockDataProvider.cs | 4 ++ .../MonoStockPortfolio.Tests.csproj | 59 +++++++++---------- .../Given_an_initialized_Config_Presenter.cs | 0 .../When_initialize_the_config_presenter.cs | 0 ...en_the_user_wants_to_save_configuration.cs | 0 .../{ => EditPortfolio}/EditPortfolioTests.cs | 0 ...the_edit_portfolio_presenter_with_an_id.cs | 0 ...the_edit_portfolio_presenter_with_no_id.cs | 0 ..._save_a_new_portfolio_with_a_blank_name.cs | 0 ...save_a_portfolio_with_a_duplicated_name.cs | 0 ...he_user_wants_to_save_a_valid_portfolio.cs | 0 .../{ => EditPosition}/EditPositionTests.cs | 2 +- ..._the_edit_position_presenter_with_an_id.cs | 2 +- ..._the_edit_position_presenter_with_no_id.cs | 2 +- ...the_user_wants_to_save_a_valid_position.cs | 4 +- ..._user_wants_to_save_an_invalid_position.cs | 4 +- ...e_an_invalid_position_with_blank_fields.cs | 4 +- .../{ => Main}/MainPresenterTests.cs | 0 .../When_initializing_the_Main_Presenter.cs | 5 +- ...n_the_user_wants_to_add_a_new_portfolio.cs | 0 ...r_wants_to_configure_the_display_fields.cs | 0 ...en_the_user_wants_to_delete_a_portfolio.cs | 0 ...When_the_user_wants_to_edit_a_portfolio.cs | 0 .../When_the_user_wants_to_exit_the_app.cs | 0 ...When_the_user_wants_to_view_a_portfolio.cs | 0 .../PortfolioPresenterTests.cs | 0 ...done_initializing_a_Portfolio_Presenter.cs | 0 ..._the_user_selects_delete_context_option.cs | 0 ...en_the_user_selects_edit_context_option.cs | 0 ...en_the_user_wants_to_add_a_new_position.cs | 0 ...the_user_wants_to_refresh_the_positions.cs | 0 ..._the_user_wants_to_see_the_context_menu.cs | 21 ------- .../Services/YahooStockDataServiceTests.cs | 2 - .../EditPositionActivity.cs | 2 +- .../EditPositionPresenter.cs | 3 +- .../EditPositionScreen/IEditPositionView.cs | 2 +- 37 files changed, 51 insertions(+), 67 deletions(-) rename MonoStockPortfolio.Tests/Presenters/{ => Config}/Given_an_initialized_Config_Presenter.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Config}/When_initialize_the_config_presenter.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Config}/When_the_user_wants_to_save_configuration.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/EditPortfolioTests.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/When_initializing_the_edit_portfolio_presenter_with_an_id.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/When_initializing_the_edit_portfolio_presenter_with_no_id.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/When_the_user_tries_to_save_a_new_portfolio_with_a_blank_name.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/When_the_user_tries_to_save_a_portfolio_with_a_duplicated_name.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPortfolio}/When_the_user_wants_to_save_a_valid_portfolio.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/EditPositionTests.cs (91%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/When_initializing_the_edit_position_presenter_with_an_id.cs (93%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/When_initializing_the_edit_position_presenter_with_no_id.cs (89%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/When_the_user_wants_to_save_a_valid_position.cs (90%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/When_the_user_wants_to_save_an_invalid_position.cs (91%) rename MonoStockPortfolio.Tests/Presenters/{ => EditPosition}/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs (91%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/MainPresenterTests.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_initializing_the_Main_Presenter.cs (81%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_add_a_new_portfolio.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_configure_the_display_fields.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_delete_a_portfolio.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_edit_a_portfolio.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_exit_the_app.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Main}/When_the_user_wants_to_view_a_portfolio.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/PortfolioPresenterTests.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/When_done_initializing_a_Portfolio_Presenter.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/When_the_user_selects_delete_context_option.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/When_the_user_selects_edit_context_option.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/When_the_user_wants_to_add_a_new_position.cs (100%) rename MonoStockPortfolio.Tests/Presenters/{ => Portfolio}/When_the_user_wants_to_refresh_the_positions.cs (100%) delete mode 100644 MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_see_the_context_menu.cs diff --git a/MonoDroid.LumenWorks.Framework.IO.Csv/MonoDroid.LumenWorks.Framework.IO.Csv.csproj b/MonoDroid.LumenWorks.Framework.IO.Csv/MonoDroid.LumenWorks.Framework.IO.Csv.csproj index 77d6eea..051473d 100644 --- a/MonoDroid.LumenWorks.Framework.IO.Csv/MonoDroid.LumenWorks.Framework.IO.Csv.csproj +++ b/MonoDroid.LumenWorks.Framework.IO.Csv/MonoDroid.LumenWorks.Framework.IO.Csv.csproj @@ -31,6 +31,8 @@ TRACE prompt 4 + True + SdkOnly diff --git a/MonoStockPortfolio.Core/StockData/YahooStockDataProvider.cs b/MonoStockPortfolio.Core/StockData/YahooStockDataProvider.cs index 4c2a926..247b75c 100644 --- a/MonoStockPortfolio.Core/StockData/YahooStockDataProvider.cs +++ b/MonoStockPortfolio.Core/StockData/YahooStockDataProvider.cs @@ -51,6 +51,10 @@ namespace MonoStockPortfolio.Core.StockData // if it can't find the ticker public bool IsValidTicker(string ticker) { + if(string.IsNullOrEmpty(ticker)) + { + return false; + } var quote = GetStockQuotes(new[] {ticker}).Single(); return quote.LastTradePrice > 0.0M; } diff --git a/MonoStockPortfolio.Tests/MonoStockPortfolio.Tests.csproj b/MonoStockPortfolio.Tests/MonoStockPortfolio.Tests.csproj index 44e15d3..3ee5739 100644 --- a/MonoStockPortfolio.Tests/MonoStockPortfolio.Tests.csproj +++ b/MonoStockPortfolio.Tests/MonoStockPortfolio.Tests.csproj @@ -61,36 +61,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MonoStockPortfolio.Tests/Presenters/Given_an_initialized_Config_Presenter.cs b/MonoStockPortfolio.Tests/Presenters/Config/Given_an_initialized_Config_Presenter.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/Given_an_initialized_Config_Presenter.cs rename to MonoStockPortfolio.Tests/Presenters/Config/Given_an_initialized_Config_Presenter.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_initialize_the_config_presenter.cs b/MonoStockPortfolio.Tests/Presenters/Config/When_initialize_the_config_presenter.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_initialize_the_config_presenter.cs rename to MonoStockPortfolio.Tests/Presenters/Config/When_initialize_the_config_presenter.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_configuration.cs b/MonoStockPortfolio.Tests/Presenters/Config/When_the_user_wants_to_save_configuration.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_configuration.cs rename to MonoStockPortfolio.Tests/Presenters/Config/When_the_user_wants_to_save_configuration.cs diff --git a/MonoStockPortfolio.Tests/Presenters/EditPortfolioTests.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/EditPortfolioTests.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/EditPortfolioTests.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/EditPortfolioTests.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_portfolio_presenter_with_an_id.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_initializing_the_edit_portfolio_presenter_with_an_id.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_portfolio_presenter_with_an_id.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_initializing_the_edit_portfolio_presenter_with_an_id.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_portfolio_presenter_with_no_id.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_initializing_the_edit_portfolio_presenter_with_no_id.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_portfolio_presenter_with_no_id.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_initializing_the_edit_portfolio_presenter_with_no_id.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_tries_to_save_a_new_portfolio_with_a_blank_name.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_tries_to_save_a_new_portfolio_with_a_blank_name.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_tries_to_save_a_new_portfolio_with_a_blank_name.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_tries_to_save_a_new_portfolio_with_a_blank_name.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_tries_to_save_a_portfolio_with_a_duplicated_name.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_tries_to_save_a_portfolio_with_a_duplicated_name.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_tries_to_save_a_portfolio_with_a_duplicated_name.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_tries_to_save_a_portfolio_with_a_duplicated_name.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_a_valid_portfolio.cs b/MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_wants_to_save_a_valid_portfolio.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_a_valid_portfolio.cs rename to MonoStockPortfolio.Tests/Presenters/EditPortfolio/When_the_user_wants_to_save_a_valid_portfolio.cs diff --git a/MonoStockPortfolio.Tests/Presenters/EditPositionTests.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/EditPositionTests.cs similarity index 91% rename from MonoStockPortfolio.Tests/Presenters/EditPositionTests.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/EditPositionTests.cs index f0be488..db41183 100644 --- a/MonoStockPortfolio.Tests/Presenters/EditPositionTests.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/EditPositionTests.cs @@ -4,7 +4,7 @@ using MonoStockPortfolio.Core.PortfolioRepositories; using MonoStockPortfolio.Core.StockData; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { public class EditPositionTests { diff --git a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_an_id.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_an_id.cs similarity index 93% rename from MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_an_id.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_an_id.cs index 9793283..65f2e1b 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_an_id.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_an_id.cs @@ -2,7 +2,7 @@ using MonoStockPortfolio.Entities; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { [Tags("UnitTest")] public class When_initializing_the_edit_position_presenter_with_an_id : EditPositionTests diff --git a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_no_id.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_no_id.cs similarity index 89% rename from MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_no_id.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_no_id.cs index 20549d1..efa2c99 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_edit_position_presenter_with_no_id.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_initializing_the_edit_position_presenter_with_no_id.cs @@ -2,7 +2,7 @@ using MonoStockPortfolio.Entities; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { [Tags("UnitTest")] public class When_initializing_the_edit_position_presenter_with_no_id : EditPositionTests diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_a_valid_position.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_a_valid_position.cs similarity index 90% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_a_valid_position.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_a_valid_position.cs index 392abe7..483faaf 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_a_valid_position.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_a_valid_position.cs @@ -3,7 +3,7 @@ using MonoStockPortfolio.Activites.EditPositionScreen; using MonoStockPortfolio.Entities; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { [Tags("UnitTest")] public class When_the_user_wants_to_save_a_valid_position : EditPositionTests @@ -32,6 +32,6 @@ namespace MonoStockPortfolio.Tests.Presenters It should_save_a_position_with_the_correct_Containing_Portfolio_ID = () => Mock.Assert(() => _mockPortfolioRepository.SavePosition(Arg.Matches(p => p.ContainingPortfolioID == 1)), Occurs.Exactly(1)); It should_tell_the_view_to_go_back_to_the_main_activity = () => - Mock.Assert(() => _mockView.GoBackToMainActivity(), Occurs.Exactly(1)); + Mock.Assert(() => _mockView.GoBackToPortfolioActivity(), Occurs.Exactly(1)); } } \ No newline at end of file diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position.cs similarity index 91% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position.cs index 30ebe3a..93828c9 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position.cs @@ -7,7 +7,7 @@ using MonoStockPortfolio.Activites.EditPositionScreen; using MonoStockPortfolio.Entities; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { [Tags("UnitTest")] public class When_the_user_wants_to_save_an_invalid_position : EditPositionTests @@ -36,7 +36,7 @@ namespace MonoStockPortfolio.Tests.Presenters It should_send_an_invalid_price_per_share_error_to_the_view = () => MockAssertPositionMatches(x => x.Any(p => p == "Please enter a valid, positive price per share")); It should_not_tell_the_view_to_go_back_to_the_main_activity = () => - Mock.Assert(() => _mockView.GoBackToMainActivity(), Occurs.Never()); + Mock.Assert(() => _mockView.GoBackToPortfolioActivity(), Occurs.Never()); private static void MockAssertPositionMatches(Expression>> match) { diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs similarity index 91% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs rename to MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs index b2764a0..cb23c08 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs +++ b/MonoStockPortfolio.Tests/Presenters/EditPosition/When_the_user_wants_to_save_an_invalid_position_with_blank_fields.cs @@ -7,7 +7,7 @@ using MonoStockPortfolio.Activites.EditPositionScreen; using MonoStockPortfolio.Entities; using Telerik.JustMock; -namespace MonoStockPortfolio.Tests.Presenters +namespace MonoStockPortfolio.Tests.Presenters.EditPosition { [Tags("UnitTest")] public class When_the_user_wants_to_save_an_invalid_position_with_blank_fields : EditPositionTests @@ -36,7 +36,7 @@ namespace MonoStockPortfolio.Tests.Presenters It should_send_an_invalid_price_per_share_error_to_the_view = () => MockPositionMatches(x => x.Any(p => p == "Please enter a valid, positive price per share")); It should_not_tell_the_view_to_go_back_to_the_main_activity = () => - Mock.Assert(() => _mockView.GoBackToMainActivity(), Occurs.Never()); + Mock.Assert(() => _mockView.GoBackToPortfolioActivity(), Occurs.Never()); private static void MockPositionMatches(Expression>> match) { diff --git a/MonoStockPortfolio.Tests/Presenters/MainPresenterTests.cs b/MonoStockPortfolio.Tests/Presenters/Main/MainPresenterTests.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/MainPresenterTests.cs rename to MonoStockPortfolio.Tests/Presenters/Main/MainPresenterTests.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_Main_Presenter.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_initializing_the_Main_Presenter.cs similarity index 81% rename from MonoStockPortfolio.Tests/Presenters/When_initializing_the_Main_Presenter.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_initializing_the_Main_Presenter.cs index e8b5f22..a4719de 100644 --- a/MonoStockPortfolio.Tests/Presenters/When_initializing_the_Main_Presenter.cs +++ b/MonoStockPortfolio.Tests/Presenters/Main/When_initializing_the_Main_Presenter.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using Machine.Specifications; +using MonoStockPortfolio.Entities; using Telerik.JustMock; namespace MonoStockPortfolio.Tests.Presenters @@ -11,8 +12,8 @@ namespace MonoStockPortfolio.Tests.Presenters It should_get_the_portfolio_list = () => Mock.Assert(() => _mockPortfolioRepository.GetAllPortfolios(), Occurs.Exactly(1)); It should_refresh_the_view = () => - Mock.Assert(() => _mockView.RefreshList(Arg.IsAny>()), Occurs.Exactly(1)); + Mock.Assert(() => _mockView.RefreshList(Arg.IsAny>()), Occurs.Exactly(1)); It should_refresh_the_view_with_the_portfolio_list = () => - Mock.Assert(() => _mockView.RefreshList(Arg.Matches>(stringList => stringList.SequenceEqual(_portfolioList.Select(p => p.Name))))); + Mock.Assert(() => _mockView.RefreshList(Arg.Matches>(p => p.SequenceEqual(_portfolioList)))); } } \ No newline at end of file diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_add_a_new_portfolio.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_add_a_new_portfolio.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_add_a_new_portfolio.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_add_a_new_portfolio.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_configure_the_display_fields.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_configure_the_display_fields.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_configure_the_display_fields.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_configure_the_display_fields.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_delete_a_portfolio.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_delete_a_portfolio.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_delete_a_portfolio.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_delete_a_portfolio.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_edit_a_portfolio.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_edit_a_portfolio.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_edit_a_portfolio.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_edit_a_portfolio.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_exit_the_app.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_exit_the_app.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_exit_the_app.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_exit_the_app.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_view_a_portfolio.cs b/MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_view_a_portfolio.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_view_a_portfolio.cs rename to MonoStockPortfolio.Tests/Presenters/Main/When_the_user_wants_to_view_a_portfolio.cs diff --git a/MonoStockPortfolio.Tests/Presenters/PortfolioPresenterTests.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/PortfolioPresenterTests.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/PortfolioPresenterTests.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/PortfolioPresenterTests.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_done_initializing_a_Portfolio_Presenter.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/When_done_initializing_a_Portfolio_Presenter.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_done_initializing_a_Portfolio_Presenter.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/When_done_initializing_a_Portfolio_Presenter.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_selects_delete_context_option.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_selects_delete_context_option.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_selects_delete_context_option.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_selects_delete_context_option.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_selects_edit_context_option.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_selects_edit_context_option.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_selects_edit_context_option.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_selects_edit_context_option.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_add_a_new_position.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_wants_to_add_a_new_position.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_add_a_new_position.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_wants_to_add_a_new_position.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_refresh_the_positions.cs b/MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_wants_to_refresh_the_positions.cs similarity index 100% rename from MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_refresh_the_positions.cs rename to MonoStockPortfolio.Tests/Presenters/Portfolio/When_the_user_wants_to_refresh_the_positions.cs diff --git a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_see_the_context_menu.cs b/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_see_the_context_menu.cs deleted file mode 100644 index 9a475a1..0000000 --- a/MonoStockPortfolio.Tests/Presenters/When_the_user_wants_to_see_the_context_menu.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Machine.Specifications; -using MonoStockPortfolio.Tests.Presenters; -using Telerik.JustMock; - -namespace MonoStockPortfolio.Tests.Activities -{ - [Tags("UnitTest")] - public class When_the_user_wants_to_see_the_context_menu : Given_an_initialized_Main_Presenter - { - static int _id; - - Because of = () => - _id = _presenter.GetPortfolioIdForContextMenu(_portfolio1.Name); - - It should_use_the_given_name_to_lookup_the_ID = () => - { - Mock.Assert(() => _mockPortfolioRepository.GetPortfolioByName(_portfolio1.Name), Occurs.Exactly(1)); - _portfolio1.ID.ShouldEqual(_id); - }; - } -} \ No newline at end of file diff --git a/MonoStockPortfolio.Tests/Services/YahooStockDataServiceTests.cs b/MonoStockPortfolio.Tests/Services/YahooStockDataServiceTests.cs index 70e5d0d..51ca727 100644 --- a/MonoStockPortfolio.Tests/Services/YahooStockDataServiceTests.cs +++ b/MonoStockPortfolio.Tests/Services/YahooStockDataServiceTests.cs @@ -28,7 +28,5 @@ namespace MonoStockPortfolio.Tests.Services _quotes.ForEach(q => string.IsNullOrEmpty(q.Volume).ShouldBeFalse()); It should_get_last_trade_prices_from_the_web = () => _quotes.ForEach(q => q.LastTradePrice.ShouldNotEqual(0.0M)); - It should_get_price_change_from_the_web = () => - _quotes.ForEach(q => q.Change.ShouldNotEqual(0.0M)); } } \ No newline at end of file diff --git a/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionActivity.cs b/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionActivity.cs index 358ca85..9d2e954 100644 --- a/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionActivity.cs +++ b/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionActivity.cs @@ -52,7 +52,7 @@ namespace MonoStockPortfolio.Activites.EditPositionScreen this.SharesTextBox.Text = position.Shares.ToString(); } - public void GoBackToMainActivity() + public void GoBackToPortfolioActivity() { this.EndActivity(); } diff --git a/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionPresenter.cs b/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionPresenter.cs index 93fc728..031d512 100644 --- a/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionPresenter.cs +++ b/MonoStockPortfolio/Activites/EditPositionScreen/EditPositionPresenter.cs @@ -1,4 +1,5 @@ using System.Linq; +using Android.Util; using MonoStockPortfolio.Core.PortfolioRepositories; using MonoStockPortfolio.Core.StockData; using MonoStockPortfolio.Entities; @@ -50,7 +51,7 @@ namespace MonoStockPortfolio.Activites.EditPositionScreen if (!errorMessages.Any()) { _portfolioRepository.SavePosition(GetPosition(positionInputModel)); - _currentView.GoBackToMainActivity(); + _currentView.GoBackToPortfolioActivity(); } else { diff --git a/MonoStockPortfolio/Activites/EditPositionScreen/IEditPositionView.cs b/MonoStockPortfolio/Activites/EditPositionScreen/IEditPositionView.cs index ec0749d..cdd83c7 100644 --- a/MonoStockPortfolio/Activites/EditPositionScreen/IEditPositionView.cs +++ b/MonoStockPortfolio/Activites/EditPositionScreen/IEditPositionView.cs @@ -7,7 +7,7 @@ namespace MonoStockPortfolio.Activites.EditPositionScreen { void SetTitle(string title); void PopulateForm(Position position); - void GoBackToMainActivity(); + void GoBackToPortfolioActivity(); void ShowErrorMessages(IList errorMessages); } } \ No newline at end of file