Example #1
0
        public void ShouldBeAbleToProcessTheFeed()
        {
            var account = new Account(new AccountId(87654123), new ClientId("ABC823")) { Balance = 4000, LastUpdatedDate = DateTime.Now };
            var mockRepository = new Mock<IRepository>();
            var feedProcessor = new FeedProcessor(mockRepository.Object, "../../../Pickup/feed.csv");

            mockRepository.Setup(repo => repo.Save(account));
            feedProcessor.Process();
            mockRepository.Verify(repo => repo.Save(account));
        }
Example #2
0
        public void PerformanceTestForStructureProcessing()
        {
            var repositoryStub = new RepositoryStub();
            var interestRate = new Mock<InterestRates>();
            interestRate.Setup(ir => ir.PositiveInterestRate()).Returns(2.0);
            interestRate.Setup(ir => ir.NegativeInterestRate()).Returns(3.0);
            var feedProcessor = new FeedProcessor(repositoryStub, "../../../Pickup/testdata/feed.csv");
            feedProcessor.Process();

            var paymentInstructionService = new PaymentInstructionService();
            var structures = repositoryStub.Accounts.GroupBy(a => a.GetClientId())
                                            .Select(g => new
                                                             {
                                                                 ClientAccount = new ClientAccounts(g),
                                                                 Allocation=GetAllocation(g.ToList())
                                                             })
                                            .Select(cs=>new Structure(cs.ClientAccount, cs.Allocation, interestRate.Object, paymentInstructionService));
            var structureList = structures.ToList();

            var start = DateTime.Now.Ticks;
            structureList.ForEach(s=>s.GeneratePaymentInstruction());
            var stop = DateTime.Now.Ticks;
            Console.WriteLine((stop-start)/10000);
        }