diff --git a/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj b/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj index 1626d04..ef8cf74 100644 --- a/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj +++ b/MonoStockPortfolio.Core/MonoStockPortfolio.Core.csproj @@ -48,6 +48,7 @@ + diff --git a/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs b/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs new file mode 100644 index 0000000..2b2d57f --- /dev/null +++ b/MonoStockPortfolio.Core/PortfolioRepositories/FakePortfolioRepository.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.Linq; +using MonoStockPortfolio.Entities; + +namespace MonoStockPortfolio.Core.PortfolioRepositories +{ + public class FakePortfolioRepository : IPortfolioRepository + { + public IList GetAllPortfolios() + { + return new List {new Portfolio(1) {Name = "test portfolio"}}; + } + + public void SavePortfolio(Portfolio portfolio) + { + ; + } + + public void DeletePortfolioById(int portfolioId) + { + ; + } + + public IList GetAllPositions(long portfolioId) + { + var list = new List(); + list.Add(new Position(1) { ContainingPortfolioID = 1, PricePerShare = 5, Shares = 280, Ticker = "XIN"}); + list.Add(new Position(2) { ContainingPortfolioID = 1, PricePerShare = 3, Shares = 100, Ticker = "DENN"}); + list.Add(new Position(3) { ContainingPortfolioID = 1, PricePerShare = 25, Shares = 300, Ticker = "MSFT"}); + list.Add(new Position(4) { ContainingPortfolioID = 1, PricePerShare = 590.18M, Shares = 400, Ticker = "GOOG"}); + list.Add(new Position(5) { ContainingPortfolioID = 1, PricePerShare = 330.10M, Shares = 500, Ticker = "AAPL"}); + list.Add(new Position(6) { ContainingPortfolioID = 1, PricePerShare = 15.10M, Shares = 600, Ticker = "YHOO"}); + return list; + } + + public Portfolio GetPortfolioById(long portfolioId) + { + return GetAllPortfolios().First(); + } + + public void SavePosition(Position position) + { + ; + } + + public Portfolio GetPortfolioByName(string portfolioName) + { + return GetAllPortfolios().First(p => p.Name == portfolioName); + } + } +} \ No newline at end of file diff --git a/MonoStockPortfolio.Core/Services/PortfolioService.cs b/MonoStockPortfolio.Core/Services/PortfolioService.cs index b58d2e1..af9cce3 100644 --- a/MonoStockPortfolio.Core/Services/PortfolioService.cs +++ b/MonoStockPortfolio.Core/Services/PortfolioService.cs @@ -14,7 +14,7 @@ namespace MonoStockPortfolio.Core.Services private readonly IPortfolioRepository _portRepo; private readonly IStockDataProvider _stockRepo; - public PortfolioService(Context context) : this(new AndroidSqlitePortfolioRepository(context), + public PortfolioService(Context context) : this(new FakePortfolioRepository(), new YahooStockDataProvider()) { } diff --git a/MonoStockPortfolio/Activites/PortfolioActivity.cs b/MonoStockPortfolio/Activites/PortfolioActivity.cs index ad1ba0c..8fa212a 100644 --- a/MonoStockPortfolio/Activites/PortfolioActivity.cs +++ b/MonoStockPortfolio/Activites/PortfolioActivity.cs @@ -13,6 +13,7 @@ using MonoStockPortfolio.Core; using MonoStockPortfolio.Core.Services; using MonoStockPortfolio.Entities; using MonoStockPortfolio.Framework; +using Orientation = Android.Widget.Orientation; namespace MonoStockPortfolio.Activites { @@ -122,6 +123,7 @@ namespace MonoStockPortfolio.Activites var columnWidth = width / item.Items.Count; var row = new LinearLayout(Context); + row.Orientation = Orientation.Horizontal; foreach (var stockDataItem in GetStockItemsFromConfig()) { var cell = new TextView(Context); diff --git a/MonoStockPortfolio/Framework/IoCAttribute.cs b/MonoStockPortfolio/Framework/IoCAttribute.cs index efb1cff..ff55fc8 100644 --- a/MonoStockPortfolio/Framework/IoCAttribute.cs +++ b/MonoStockPortfolio/Framework/IoCAttribute.cs @@ -47,7 +47,8 @@ namespace MonoStockPortfolio.Framework { var map = new Dictionary>(); map.Add(typeof(IPortfolioService), () => new PortfolioService(_context)); - map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context)); + //map.Add(typeof(IPortfolioRepository), () => new AndroidSqlitePortfolioRepository(_context)); + map.Add(typeof(IPortfolioRepository), () => new FakePortfolioRepository()); return map; } diff --git a/MonoStockPortfolio/MonoStockPortfolio.csproj b/MonoStockPortfolio/MonoStockPortfolio.csproj index 0818591..81726fb 100644 --- a/MonoStockPortfolio/MonoStockPortfolio.csproj +++ b/MonoStockPortfolio/MonoStockPortfolio.csproj @@ -124,11 +124,6 @@ - - - Designer - -