private static NetWorth  convertToNetWorthObject(DataRow dr)
        {
            //NetWorth netWorth = new NetWorth()
            //{
            //    Id = dr.Field<int>("Id"),
            //    CId = dr.Field<int>("CID"),
            //    Year = dr.Field<int>("Year"),
            //    Amount = double.Parse(dr["NetWorth"].ToString()),
            //    CreatedOn = dr.Field<DateTime>("CreatedOn"),
            //    CreatedBy = dr.Field<int>("CreatedBy"),
            //    UpdatedOn = dr.Field<DateTime>("UpdatedOn"),
            //    UpdatedBy = dr.Field<int>("UpdatedBy"),
            //    UpdatedByUserName = dr.Field<string>("UpdatedByUserName")
            //};
            NetWorth netWorth = new NetWorth();

            netWorth.Id                = dr.Field <int>("Id");
            netWorth.CId               = dr.Field <int>("CID");
            netWorth.Year              = dr.Field <int>("Year");
            netWorth.Amount            = double.Parse(dr["Networth"].ToString());
            netWorth.CreatedOn         = dr.Field <DateTime>("CreatedOn");
            netWorth.CreatedBy         = dr.Field <int>("CreatedBy");
            netWorth.UpdatedOn         = dr.Field <DateTime>("UpdatedOn");
            netWorth.UpdatedBy         = dr.Field <int>("UpdatedBy");
            netWorth.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");

            return(netWorth);
        }
Exemple #2
0
        //[Route("GetNetWorth")]
        public IActionResult GetNetWorth(PortFolioDetails portFolioDetails)
        {
            NetWorth _netWorth = new NetWorth();

            _log4net.Info("Calculating the networth");

            try
            {
                //if(HttpContext.Request.Body == null)
                //{
                //    return BadRequest("Please provide a valid PortFolio");

                //}
                //else if (portFolioDetails.ToString() == "")
                //{
                //    return BadRequest("Please provide a valid PortFolio");
                //}

                //else if(portFolioDetails.MutualFundList==null && portFolioDetails.StockList == null)
                //{
                //    _log4net.Info("Both The lists are empty");
                //    return BadRequest("The customer doesn't hold any assets");
                //}

                _netWorth = _netWorthProvider.calculateNetWorthAsync(portFolioDetails).Result;
                return(Ok(_netWorth));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemple #3
0
        public void mustWriteDocumentIfDoesntExists()
        {
            var fileManager = new FileDataManager();

            var model = new NetWorth
            {
                RecordId = "bingo",
                Entries  = new List <FinancialRecord>
                {
                    new FinancialRecord {
                        Id         = 3,
                        Currency   = "CDN",
                        RecordType = RecordType.ShortTermAsset,
                        Name       = "Chequing",
                        Rate       = 10.5,
                        Value      = 1000
                    },
                    new FinancialRecord {
                        Id         = 4,
                        Currency   = "CDN",
                        RecordType = RecordType.ShortTermLiability,
                        Name       = "Mortgage",
                        Rate       = 10.5,
                        Value      = 1000
                    }
                }
            };

            fileManager.CreateOrUpdate(model);

            var foundModel = fileManager.Read(model.RecordId);

            Assert.IsNotNull(foundModel);
        }
Exemple #4
0
        /// <summary>
        /// Creates a new player record based on a player name.
        /// </summary>
        /// <param name="name">Name of the player to create</param>
        /// <returns>Player record.</returns>
        public static Player Create(string name)
        {
            // Initialize the new player.
            var createDate = DateTime.Now;
            var player     = new Player
            {
                Name             = name,
                JoinDate         = createDate,
                LastLoggedInDate = createDate
            };

            PlayerRepository.Create(player);
            var createdPlayer = PlayerRepository.GetByName(player.Name);

            // Initialize the new player's Net Worth
            var netWorth = new NetWorth
            {
                PlayerId        = createdPlayer.Id,
                Value           = 0,
                LastUpdatedDate = createDate
            };

            NetWorthRepository.Create(netWorth);
            var createdNetWorth = NetWorthRepository.GetByPlayerId(createdPlayer.Id);

            // Reputations will be initialized the first time they change.

            // Build the player.
            createdPlayer.NetWorth = createdNetWorth;
            createdPlayer.Bounties = new List <Bounty>();

            return(createdPlayer);
        }
        public void CreateOrUpdate(NetWorth model)
        {
            List <NetWorth> database;

            using (StreamReader file = File.OpenText(fileName))
            {
                JsonSerializer serializer = new JsonSerializer();
                database = (List <NetWorth>)serializer.Deserialize(file, typeof(List <NetWorth>));

                if (database == null)
                {
                    database = new List <NetWorth>();
                }

                var found = database.Find(x => x.RecordId == model.RecordId);
                if (found != null)
                {
                    var index = database.IndexOf(found);
                    database[index] = model;
                }
                else
                {
                    database.Add(model);
                }
                file.Close();
            }

            using (StreamWriter file = File.CreateText(fileName))
            {
                JsonSerializer serializer = new JsonSerializer();
                //serialize object directly into file stream
                serializer.Serialize(file, database);
                file.Close();
            }
        }
        public NetWorth Put(NetWorth netWorth)
        {
            _netWorthRepository.UpdateNetWorth(netWorth);
            var result = _netWorthRepository.GetNetWorthById(netWorth.Id);

            return(result);
        }
Exemple #7
0
        public IEnumerable <NetWorth> GetNetWorths(Guid userId, int amount)
        {
            using var conn = new NpgsqlConnection(_config["ConnectionString"]);
            conn.Open();
            const string selectCommand = "SELECT id, userid, datecreated, total FROM networthreport " +
                                         "WHERE userid = @userid ORDER BY datecreated desc LIMIT @amount";
            var listToReturn = new List <NetWorth>();

            using var cmd = new NpgsqlCommand(selectCommand, conn);
            cmd.Parameters.AddWithValue("userid", userId);
            cmd.Parameters.AddWithValue("amount", amount);
            using var reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                var networth = new NetWorth
                {
                    Id              = reader.GetGuid(0),
                    UserId          = reader.GetGuid(1),
                    DateTimeCreated = reader.GetDateTime(2),
                    Total           = reader.GetDecimal(3)
                };
                listToReturn.Add(networth);
            }
            return(listToReturn);
        }
Exemple #8
0
        public NetWorth GetNetWorth(Guid userId, Guid netWorthId)
        {
            using var conn = new NpgsqlConnection(_config["ConnectionString"]);
            conn.Open();
            const string selectCommand = "SELECT id, userid, datecreated, total FROM networthreport " +
                                         "WHERE userid = @userid AND id = @id ORDER BY datecreated desc LIMIT 1";

            using var cmd = new NpgsqlCommand(selectCommand, conn);
            cmd.Parameters.AddWithValue("id", netWorthId);
            cmd.Parameters.AddWithValue("userid", userId);
            using var reader = cmd.ExecuteReader();
            if (!reader.HasRows)
            {
                return(null);
            }
            reader.Read();
            var networth = new NetWorth
            {
                Id              = reader.GetGuid(0),
                UserId          = reader.GetGuid(1),
                DateTimeCreated = reader.GetDateTime(2),
                Total           = reader.GetDecimal(3)
            };

            return(networth);
        }
 public void InsertNetworth(NetWorth netWorth)
 {
     if (netWorth != null)
     {
         NetWorths.Add(netWorth);
     }
 }
Exemple #10
0
        public void AddNetWorth(NetWorthModel netWorthModel)
        {
            var cash = new Cash {
                Id = Guid.NewGuid()
            };
            var investedAssets = new InvestedAssets {
                Id = Guid.NewGuid()
            };
            var useAssets = new UseAssets {
                Id = Guid.NewGuid()
            };
            var liabilities = new Liabilities {
                Id = Guid.NewGuid()
            };

            _mapper.Map(netWorthModel, cash);
            _mapper.Map(netWorthModel, investedAssets);
            _mapper.Map(netWorthModel, useAssets);
            _mapper.Map(netWorthModel, liabilities);

            var netWorth = new NetWorth
            {
                Id              = Guid.NewGuid(),
                UserId          = netWorthModel.UserId,
                DateTimeCreated = DateTime.Now,
                Total           = cash.GetTotal() + investedAssets.GetTotal() + useAssets.GetTotal() - liabilities.GetTotal()
            };

            _netWorthRepository.InsertNetWorth(netWorth);
            _cashRepository.InsertCash(cash, netWorth.Id);
            _investedAssetsRepository.InsertInvestedAssets(investedAssets, netWorth.Id);
            _useAssetsRepository.InsertUseAssets(useAssets, netWorth.Id);
            _liabilitiesRepository.InsertLiabilities(liabilities, netWorth.Id);
        }
Exemple #11
0
        public IActionResult GetNetWorth(PortFolioDetails portFolioDetails)
        {
            NetWorth _netWorth = new NetWorth();

            _log4net.Info("Calculating the networth of user with id = " + portFolioDetails.PortFolioId + "In the method:" + nameof(GetNetWorth));

            try
            {
                if (portFolioDetails == null)
                {
                    return(NotFound("The portfolio doesn't contain any data"));
                }
                else if (portFolioDetails.PortFolioId == 0)
                {
                    return(NotFound("The user with that id not found"));
                }
                else
                {
                    _log4net.Info("The portfolio details are correct.Returning the networth of user with id" + portFolioDetails.PortFolioId);
                    _netWorth = _netWorthProvider.calculateNetWorthAsync(portFolioDetails).Result;
                    _log4net.Info("The networth is:" + JsonConvert.SerializeObject(_netWorth));
                    return(Ok(_netWorth));
                }
            }
            catch (Exception ex)
            {
                _log4net.Info("An exception occured while calculating the networth:" + ex + " In the controller" + nameof(GetNetWorth));
                return(new StatusCodeResult(500));
            }
        }
        public void Setup()
        {
            _model = new NetWorth
            {
                RecordId = "bingo",
                Entries  = new List <FinancialRecord>
                {
                    new FinancialRecord {
                        Id         = 1,
                        Currency   = "CDN",
                        RecordType = RecordType.ShortTermAsset,
                        Name       = "Chequing",
                        Rate       = 10.5,
                        Value      = 1000
                    },
                    new FinancialRecord {
                        Id         = 2,
                        Currency   = "CDN",
                        RecordType = RecordType.ShortTermLiability,
                        Name       = "Mortgage",
                        Rate       = 10.5,
                        Value      = 1000
                    }
                }
            };

            _mockDataManager = new Mock <IManageData>();
            _mockDataManager.Setup(x => x.Read(It.IsAny <string>())).Returns <string>(y => _model);

            _mockCurrencyManager = new Mock <IManageCurrency>();
            _mockCurrencyManager.Setup(x => x.GetExchangeRate(It.IsAny <string>())).Returns <double>(y => .5);
        }
        public void CalculateNetWorthMustReturnNullIfNullGiven()
        {
            _mockCurrencyManager = new Mock <IManageCurrency>();
            _mockCurrencyManager.Setup(x => x.GetExchangeRate(It.IsAny <string>())).Returns <string>(y => 1);
            var controller = new MainController(_mockCurrencyManager.Object, _mockDataManager.Object);

            var netWorth = new NetWorth
            {
                Currency = "CDN",
                Entries  = new List <FinancialRecord>
                {
                    new FinancialRecord {
                        Id         = 1,
                        RecordType = RecordType.ShortTermAsset,
                        Name       = "Chequing",
                        Rate       = 10.5,
                        Value      = 2000
                    },
                    new FinancialRecord {
                        Id         = 2,
                        RecordType = RecordType.ShortTermLiability,
                        Name       = "Mortgage",
                        Rate       = 10.5,
                        Value      = 1000
                    }
                }
            };

            _mockDataManager.Setup(x => x.Read(It.IsAny <string>())).Returns <string>(y => netWorth);
            var result = controller.CalculateNetWorth(null);

            Assert.Null(result);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            NetWorth netWorth = db.NetWorths.Find(id);

            db.NetWorths.Remove(netWorth);
            db.SaveChanges();
            return(RedirectToAction("NetWorth"));
        }
        /// <summary>
        /// This Will calculate the networth of the Client based on the number of stocks and mutual Funds he has.
        /// </summary>
        /// <param name="pd"></param>
        /// <returns></returns>
        ///

        public async Task <NetWorth> calculateNetWorthAsync(PortFolioDetails portFolioDetails)
        {
            Stock      stock      = new Stock();
            MutualFund mutualfund = new MutualFund();
            NetWorth   networth   = new NetWorth();

            _log4net.Info("Calculating the networth in the repository method of user with id = " + portFolioDetails.PortFolioId);
            try
            {
                using (var httpClient = new HttpClient())
                {
                    var fetchStock      = configuration["GetStockDetails"];
                    var fetchMutualFund = configuration["GetMutualFundDetails"];
                    if (portFolioDetails.StockList != null && portFolioDetails.StockList.Any() == true)
                    {
                        foreach (StockDetails stockDetails in portFolioDetails.StockList)
                        {
                            if (stockDetails.StockName != null)
                            {
                                using (var response = await httpClient.GetAsync(fetchStock + stockDetails.StockName))
                                {
                                    _log4net.Info("Fetching the details of stock " + stockDetails.StockName + "from the stock api");
                                    string apiResponse = await response.Content.ReadAsStringAsync();

                                    stock = JsonConvert.DeserializeObject <Stock>(apiResponse);
                                    _log4net.Info("Th stock details are " + JsonConvert.SerializeObject(stock));
                                }
                                networth.Networth += stockDetails.StockCount * stock.StockValue;
                            }
                        }
                    }
                    if (portFolioDetails.MutualFundList != null && portFolioDetails.MutualFundList.Any() == true)
                    {
                        foreach (MutualFundDetails mutualFundDetails in portFolioDetails.MutualFundList)
                        {
                            if (mutualFundDetails.MutualFundName != null)
                            {
                                using (var response = await httpClient.GetAsync(fetchMutualFund + mutualFundDetails.MutualFundName))
                                {
                                    _log4net.Info("Fetching the details of mutual Fund " + mutualFundDetails.MutualFundName + "from the MutualFundNAV api");
                                    string apiResponse = await response.Content.ReadAsStringAsync();

                                    mutualfund = JsonConvert.DeserializeObject <MutualFund>(apiResponse);
                                    _log4net.Info("The mutual Fund Details are" + JsonConvert.SerializeObject(mutualfund));
                                }
                                networth.Networth += mutualFundDetails.MutualFundUnits * mutualfund.MutualFundValue;
                            }
                        }
                    }
                }
                networth.Networth = Math.Round(networth.Networth, 2);
            }
            catch (Exception ex)
            {
                _log4net.Error("Exception occured while calculating the networth of user" + portFolioDetails.PortFolioId + ":" + ex.Message);
            }
            return(networth);
        }
Exemple #16
0
 public void Setup()
 {
     networth          = 10789.97;
     netWorth          = new NetWorth();
     netWorth.Networth = networth;
     assetSaleResponse = new AssetSaleResponse()
     {
         SaleStatus = true, Networth = 12456.44
     };
     _portFolioDetails = new List <PortFolioDetails>()
     {
         new PortFolioDetails
         {
             PortFolioId    = 123,
             MutualFundList = new List <MutualFundDetails>()
             {
                 new MutualFundDetails {
                     MutualFundName = "Cred", MutualFundUnits = 3
                 },
                 new MutualFundDetails {
                     MutualFundName = "Viva", MutualFundUnits = 5
                 }
             },
             StockList = new List <StockDetails>()
             {
                 new StockDetails {
                     StockCount = 1, StockName = "BTC"
                 },
                 new StockDetails {
                     StockCount = 6, StockName = "ETH"
                 }
             }
         },
         new PortFolioDetails
         {
             PortFolioId    = 12345,
             MutualFundList = new List <MutualFundDetails>()
             {
                 new MutualFundDetails {
                     MutualFundName = "Cred", MutualFundUnits = 1
                 },
                 new MutualFundDetails {
                     MutualFundName = "Viva", MutualFundUnits = 1
                 }
             },
             StockList = new List <StockDetails>()
             {
                 new StockDetails {
                     StockCount = 1, StockName = "BTC"
                 },
                 new StockDetails {
                     StockCount = 2, StockName = "ETH"
                 }
             }
         }
     };
 }
Exemple #17
0
        public bool CreateNetWorth(NetWorth model)
        {
            model.OwnerId = _userId;

            using (_ctx)
            {
                _ctx.NetWorths.Add(model);
                return(_ctx.SaveChanges() == 1);
            }
        }
 public ActionResult Edit([Bind(Include = "NetWorthID,Date,Amount")] NetWorth netWorth)
 {
     if (ModelState.IsValid)
     {
         db.Entry(netWorth).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("NetWorth"));
     }
     return(View(netWorth));
 }
        public ActionResult Create([Bind(Include = "NetWorthID,Date,Amount")] NetWorth netWorth)
        {
            if (ModelState.IsValid)
            {
                db.NetWorths.Add(netWorth);
                db.SaveChanges();
                return(RedirectToAction("NetWorth"));
            }

            return(View(netWorth));
        }
 public void Delete(NetWorth netWorth)
 {
     try
     {
         DataBase.DBService.ExecuteCommandString(string.Format(DELETE_QUERY, netWorth.Id), true);
     }
     catch (Exception ex)
     {
         FinancialPlanner.Common.Logger.LogDebug(ex.Message);
     }
 }
        /// <summary>
        /// Calculates the networth based on the details provided in the portfolio object
        /// </summary>
        /// <param name="portFolio"></param>
        /// <returns></returns>
        public async Task <NetWorth> calculateNetWorth(PortFolioDetails portFolio)
        {
            try
            {
                NetWorth _networth = new NetWorth();

                Stock      stock      = new Stock();
                MutualFund mutualFund = new MutualFund();
                double     networth   = 0;

                using (var httpClient = new HttpClient())
                {
                    var fetchStock      = configuration["GetStockDetails"];
                    var fetchMutualFund = configuration["GetMutualFundDetails"];
                    if (portFolio.StockList != null || portFolio.MutualFundList.Any() != false)
                    {
                        foreach (StockDetails stockDetails in portFolio.StockList)
                        {
                            using (var response = await httpClient.GetAsync(fetchStock + stockDetails.StockName))
                            {
                                _log4net.Info("Fetching the details of stock " + stockDetails.StockName + " from the stock api");
                                string apiResponse = await response.Content.ReadAsStringAsync();

                                stock = JsonConvert.DeserializeObject <Stock>(apiResponse);
                            }
                            networth += stockDetails.StockCount * stock.StockValue;
                        }
                    }
                    if (portFolio.MutualFundList != null || portFolio.MutualFundList.Any() != false)
                    {
                        foreach (MutualFundDetails mutualFundDetails in portFolio.MutualFundList)
                        {
                            using (var response = await httpClient.GetAsync(fetchMutualFund + mutualFundDetails.MutualFundName))
                            {
                                _log4net.Info("Fetching the details of stock " + mutualFundDetails.MutualFundName + " from the stock api");
                                string apiResponse = await response.Content.ReadAsStringAsync();

                                mutualFund = JsonConvert.DeserializeObject <MutualFund>(apiResponse);
                            }
                            networth += mutualFundDetails.MutualFundUnits * mutualFund.MutualFundValue;
                        }
                    }
                }
                networth           = Math.Round(networth, 2);
                _networth.Networth = networth;
                return(_networth);
            }
            catch (Exception ex)
            {
                _log4net.Error("An exception occured while selling the assets:" + ex.Message);
                return(null);
            }
        }
        public IList <NetWorth> Get(int clientId)
        {
            IList <NetWorth> lstNetWorth = new List <NetWorth>();

            DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, clientId));

            foreach (DataRow dr in dtAppConfig.Rows)
            {
                NetWorth netWorth = convertToNetWorthObject(dr);
                lstNetWorth.Add(netWorth);
            }
            return(lstNetWorth);
        }
Exemple #23
0
        public void InsertNetWorth(NetWorth netWorth)
        {
            using var conn = new NpgsqlConnection(_config["ConnectionString"]);
            conn.Open();
            const string insertCommand = "INSERT INTO networthreport (id, userid, datecreated, total)" +
                                         " VALUES (@id, @userid,  @datecreated, @total)";

            using var cmd = new NpgsqlCommand(insertCommand, conn);
            cmd.Parameters.AddWithValue("id", netWorth.Id);
            cmd.Parameters.AddWithValue("userid", netWorth.UserId);
            cmd.Parameters.AddWithValue("datecreated", netWorth.DateTimeCreated);
            cmd.Parameters.AddWithValue("total", netWorth.Total);
            cmd.ExecuteNonQuery();
        }
 public void Update(NetWorth netWorth)
 {
     try
     {
         DataBase.DBService.ExecuteCommandString(string.Format(UPDATE_QUERY,
                                                               netWorth.Year, netWorth.Amount, netWorth.Id));
     }
     //Activity.ActivitiesService.Add(ActivityType.UpdateUser, EntryStatus.Success,
     //           Source.Server, user.UpdatedByUserName, user.UserName, user.MachineName);
     catch (Exception ex)
     {
         FinancialPlanner.Common.Logger.LogDebug(ex.Message);
     }
 }
        // GET: NetWorths/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NetWorth netWorth = db.NetWorths.Find(id);

            if (netWorth == null)
            {
                return(HttpNotFound());
            }
            return(View(netWorth));
        }
    public void UpdateNetWorth(NetWorth netWorth)
    {
        var netWorthItem = NetWorths.SingleOrDefault(x => x.Id == netWorth.Id);

        if (netWorthItem != null)
        {
            netWorthItem.Assets      = netWorth.Assets;
            netWorthItem.Liabilities = netWorth.Liabilities;
            var assetSums     = netWorth.Assets.Sum(x => x.Amount);
            var liabilitySums = netWorth.Liabilities.Sum(x => x.Amount);
            netWorthItem.TotalAssetsAmount      = assetSums;
            netWorthItem.TotalLiabilitiesAmount = liabilitySums;
            netWorthItem.NetWorthAmount         = assetSums - liabilitySums;
        }
    }
        public void Add(NetWorth netWorth)
        {
            try
            {
                //string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, netWorth.CId));

                DataBase.DBService.ExecuteCommandString(string.Format(INSERT_QUERY,
                                                                      netWorth.CId, netWorth.Year, netWorth.Amount, netWorth.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), netWorth.CreatedBy, netWorth.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), netWorth.UpdatedBy));
                // Activity.ActivitiesService.Add(ActivityType.CreateUser, EntryStatus.Success,
                //          Source.Server, user.UpdatedByUserName, user.UserName, user.MachineName);
            }
            catch (Exception ex)
            {
                FinancialPlanner.Common.Logger.LogDebug(ex.Message);
            }
        }
        /// <summary>
        /// Update a networth object
        /// </summary>
        /// <param name="model"></param>
        /// <returns>
        /// returns response code 200 if succuessfull
        /// </returns>
        public IHttpActionResult Put(NetWorth model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateNetWorthServices();

            if (!service.UpdateNetWorth(model))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Exemple #29
0
        private NetWorthTotal ComputeTotals(NetWorth model)
        {
            if (model.Entries == null)
            {
                return(null);
            }

            var totalAssets      = model.Entries.Where(x => x.RecordType == RecordType.LongTermAsset || x.RecordType == RecordType.ShortTermAsset).Sum(x => x.Value);
            var totalLiabilities = model.Entries.Where(x => x.RecordType == RecordType.LongTermLiability || x.RecordType == RecordType.ShortTermLiability).Sum(x => x.Value);

            return(new NetWorthTotal
            {
                TotalAssets = totalAssets,
                TotalLiabilities = totalLiabilities,
                TotalNetWorth = totalAssets - totalLiabilities
            });
        }
        public void CalculateNetWorthMustReturnNullIfNoEntries()
        {
            _mockCurrencyManager = new Mock <IManageCurrency>();
            _mockCurrencyManager.Setup(x => x.GetExchangeRate(It.IsAny <string>())).Returns <string>(y => 1);
            var controller = new MainController(_mockCurrencyManager.Object, _mockDataManager.Object);

            var netWorth = new NetWorth
            {
                Currency = "CDN",
                Entries  = null
            };

            _mockDataManager.Setup(x => x.Read(It.IsAny <string>())).Returns <string>(y => netWorth);
            var result = controller.CalculateNetWorth(netWorth);

            Assert.Null(result);
        }