public void testConstructor_WalletsIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Wallets to assign to the Person List <Wallet> wallets = new List <Wallet>(); // Construct a set of Cards to put in the Wallet List <Card> cards = new List <Card>(); Card card = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); cards.Add(card); // Attempt to construct new Wallet Wallet wallet = new Wallet(cards); wallets.Add(wallet); // Attempt to construct new Person Person person = new Person("Test", "Test", wallets); // Person object should not be null Assert.NotNull(person.wallets); }
/// <summary> /// Scenario /// - Person has a Wallet with three Cards /// - A Discover with a balance of $100 /// - A MasterCard with a balance of $100 /// - A Visa with a balance of $100 /// </summary> public TestCase1() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Wallets to assign to the Person List <Wallet> wallets = new List <Wallet>(); // Construct a set of Cards to put in the Wallet List <Card> cards = new List <Card>(); card1 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); card2 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "MasterCard"); card3 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Visa"); cards.Add(card1); cards.Add(card2); cards.Add(card3); // Attempt to construct new Wallet wallet = new Wallet(cards); wallets.Add(wallet); // Attempt to construct new Person person = new Person("Test", "Test", wallets); }
public void testConstructor_Default_DataSetIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // dataSet property should not be null Assert.NotNull(InterestData.dataSet); }
public void testConstructor_Default_InterestDataIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // InterestData object should not be null Assert.NotNull(interestData); }
public void testGetCardType_ValidCardTypeName_CardTypeIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Attempt to get a CardType by a valid cardTypeName InterestData.CardType cardType = InterestData.GetCardType("Discover"); // cardType should not be null Assert.NotNull(cardType); }
public void testConstructor_CardTypeIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Attempt to construct new Card Card card = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); // cardType property should not be null Assert.NotNull(card.cardType); }
public void testCalculateBalanceWithInterest_Discover_BalanceCalculatedCorrectly() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Attempt to construct new Card Card card = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); // Attempt to calculate the current balance of the Card, with interest decimal balance = card.CalculateBalanceWithInterest(); decimal expectedBalance = 101; // balance should be equal to expectedBalance Assert.Equal(balance, expectedBalance); }
public void testCalculateInterest_Discover_InterestCalculatedCorrectly() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Attempt to construct new Card Card card = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); // Attempt to calculate the interest of the Card decimal interest = card.CalculateInterest(); decimal expectedInterest = 1; // interest should be equal to expectedInterest Assert.Equal(interest, expectedInterest); }
public void testCalculateInterest_InterestCalculatedCorrectly() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Wallets to assign to the Person List <Wallet> wallets = new List <Wallet>(); // Construct a set of Cards to put in the Wallet List <Card> cards1 = new List <Card>(); Card card1 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 125, "Discover"); Card card2 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 250, "MasterCard"); Card card3 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 300, "Visa"); cards1.Add(card1); cards1.Add(card2); cards1.Add(card3); // Attempt to construct new Wallet Wallet wallet1 = new Wallet(cards1); wallets.Add(wallet1); // Construct a set of Cards to put in the Wallet List <Card> cards2 = new List <Card>(); Card card4 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 330, "Discover"); Card card5 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 450, "MasterCard"); Card card6 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 120, "Visa"); cards2.Add(card4); cards2.Add(card5); cards2.Add(card6); // Attempt to construct new Wallet Wallet wallet2 = new Wallet(cards2); wallets.Add(wallet2); // Attempt to construct new Person Person person = new Person("Test", "Test", wallets); // Attempt to calculate the current interest of the Person decimal interest = person.CalculateInterest(); decimal expectedInterest = (decimal)81.55; // interest should be equal to expectedInterest Assert.Equal(interest, expectedInterest); }
public Response <CalculateAllInterestData> CalculateAllInterestData(CalculateLoanRequest request) { var response = new Response <CalculateAllInterestData> { Result = new CalculateAllInterestData { InterestData = new List <InterestData>() } }; try { var monthlyRateOfInterest = request.InterestRate / (12 * 100); // one month interest var closing = request.LoanAmount; var opening = request.LoanAmount; decimal cumulativeInterest = 0; var installment = 1; while (Math.Round(closing) > 0) { var interest = opening * monthlyRateOfInterest; var emi = CalculateEmi(request); var principal = emi - interest; closing = opening - principal; cumulativeInterest = cumulativeInterest + interest; var obj = new InterestData { Opening = Math.Round(opening, 2), Closing = closing < 0 ? 0 : Math.Round(closing, 2), Emi = Math.Round(emi, 2), CumulativeInterest = Math.Round(cumulativeInterest, 2), Installment = installment, Interest = Math.Round(interest, 2), Principal = Math.Round(principal, 2) }; response.Result.InterestData.Add(obj); opening = closing; installment += 1; } } catch (Exception ex) { // handle exception response.StateModel.SetErrorMessage(AppMessageConstants.SystemError, (int)AppEnum.ResponseStatusCode.WrongOperation); } return(response); }
public void testConstructor_CardsIsNotNull() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Cards to put in the Wallet List <Card> cards = new List <Card>(); Card card = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 100, "Discover"); cards.Add(card); // Attempt to construct new Wallet Wallet wallet = new Wallet(cards); // cards property should not be null Assert.NotNull(wallet.cards); }
public static unsafe void Write(global::Improbable.Worker.Internal.GcHandlePool _pool, InterestData _data, global::Improbable.Worker.CInterop.SchemaObject _obj) { if (_data.componentInterest != null) { for (var _node = _data.componentInterest.First; _node != null; _node = _node.Next) { var _pair = _obj.AddObject(1); { _pair.AddUint32(1, _node.Value.Key); } { global::Improbable.ComponentInterest_Internal.Write(_pool, _node.Value.Value, _pair.AddObject(2)); } } } }
public static unsafe void Write(global::Improbable.Worker.Internal.GcHandlePool _pool, InterestData _data, global::Improbable.Worker.Internal.Pbio.Object *_obj) { if (_data.componentInterest != null) { for (var _node = _data.componentInterest.First; _node != null; _node = _node.Next) { var _pair = global::Improbable.Worker.Internal.Pbio.AddObject(_obj, 1); { global::Improbable.Worker.Internal.Pbio.AddUint32(_pair, 1, _node.Value.Key); } { global::Improbable.ComponentInterest_Internal.Write(_pool, _node.Value.Value, global::Improbable.Worker.Internal.Pbio.AddObject(_pair, 2)); } } } }
public void testCalculateInterest_InterestCalculatedCorrectly() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Cards to put in the Wallet List <Card> cards = new List <Card>(); Card card1 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 300, "Visa"); Card card2 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 250, "MasterCard"); cards.Add(card1); cards.Add(card2); // Attempt to construct new Wallet Wallet wallet = new Wallet(cards); // Attempt to calculate the current interest of the Wallet decimal interest = wallet.CalculateInterest(); decimal expectedInterest = (decimal)42.5; // interest should be equal to expectedInterest Assert.Equal(interest, expectedInterest); }
public void testCalculateBalanceWithInterest_BalanceCalculatedCorrectly() { // Attempt to construct new InterestData InterestData interestData = new InterestData(); // Construct a set of Cards to put in the Wallet List <Card> cards = new List <Card>(); Card card1 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 300, "Visa"); Card card2 = new Card("Test Test", "0000 1111 2222 3333", "0101", "000", 250, "MasterCard"); cards.Add(card1); cards.Add(card2); // Attempt to construct new Wallet Wallet wallet = new Wallet(cards); // Attempt to calculate the current balance of the Wallet, with interest decimal balance = wallet.CalculateBalanceWithInterest(); decimal expectedBalance = (decimal)592.5; // balance should be equal to expectedBalance Assert.Equal(balance, expectedBalance); }
public Interests() { _interestWharehouse = new InterestData(); }
public AnnuityData(InterestData interestData) { _interestData = interestData; }