예제 #1
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);
        }
예제 #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);
        }