public void ShouldNotAddLiquidityMandateAsAdditionalMandateinPositionVM()
        {
            IFundsProcessor fundsProcessor = new FundProcessor();

            PositionVM inputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = null
            };

            PositionVM outputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = new List <MandateVM>
                {
                    new MandateVM {
                        Allocation = .105m, name = "Mandate1", Value = 1296
                    },
                    new MandateVM {
                        Allocation = .205m, name = "Mandate2", Value = 2531
                    },
                    new MandateVM {
                        Allocation = .305m, name = "Mandate3", Value = 3765
                    },
                    new MandateVM {
                        Allocation = .109m, name = "Mandate4", Value = 1346
                    }
                }
            };

            FundOfMandates fundOfMandates = new FundOfMandates
            {
                InstrumentCode      = "Pos1",
                InstrumentName      = "FundOfMandates1",
                LiquidityAllocation = 0,
                Mandates            = new Mandate[]
                {
                    new Mandate {
                        Allocation = 10.5m, MandateId = "Mandate1", MandateName = "Mandate1"
                    },
                    new Mandate {
                        Allocation = 20.5m, MandateId = "Mandate2", MandateName = "Mandate2"
                    },
                    new Mandate {
                        Allocation = 30.5m, MandateId = "Mandate3", MandateName = "Mandate3"
                    },
                    new Mandate {
                        Allocation = 10.9m, MandateId = "Mandate4", MandateName = "Mandate4"
                    }
                }
            };


            fundsProcessor.GetCalculatedMandates(inputPosition, fundOfMandates).Should().NotBeNull().And.BeOfType <PositionVM>().And.BeEquivalentTo(outputPosition);
        }
예제 #2
0
        public void ValidateFundOfMandatesReturnsPositionVM()
        {
            IFundProcessor        fundsProcessor = new FundProcessor();
            string                filePath       = "..\\..\\..\\TestData\\FundsOfMandatesData.xml";
            List <FundOfMandates> Result         = fundsProcessor.ReadFundOfMandateFile(filePath);
            PortfolioVM           portfolioVM    = fundsProcessor.GetPortfolio();
            PositionVM            positionVM     = null;

            positionVM = fundsProcessor.GetCalculatedMandates(portfolioVM.Positions.ElementAt(1), Result.ElementAt(1));

            positionVM.Should().NotBeNull().And.BeOfType <PositionVM>();
        }
        public void ShouldNotMakeAnyChangesToPositionVMSinceInstrumentCodeDoNotMatch()
        {
            IFundsProcessor fundsProcessor = new FundProcessor();

            PositionVM inputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = null
            };

            PositionVM outputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = null
            };

            FundOfMandates fundOfMandates = new FundOfMandates
            {
                InstrumentCode      = "Pos2",
                InstrumentName      = "FundOfMandates1",
                LiquidityAllocation = 0,
                Mandates            = new Mandate[]
                {
                    new Mandate {
                        Allocation = 10.5m, MandateId = "Mandate1", MandateName = "Mandate1"
                    },
                    new Mandate {
                        Allocation = 20.5m, MandateId = "Mandate2", MandateName = "Mandate2"
                    },
                    new Mandate {
                        Allocation = 30.5m, MandateId = "Mandate3", MandateName = "Mandate3"
                    },
                    new Mandate {
                        Allocation = 10.9m, MandateId = "Mandate4", MandateName = "Mandate4"
                    }
                }
            };


            fundsProcessor.GetCalculatedMandates(inputPosition, fundOfMandates).Should().NotBeNull().And.BeOfType <PositionVM>().And.BeEquivalentTo(outputPosition);
        }
        public void ShouldAddLiquidityMandateAsAdditionalMandateinPositionVM()
        {
            IFundsProcessor fundsProcessor = new FundProcessor();

            PositionVM inputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = null
            };

            PositionVM outputPosition = new PositionVM
            {
                Code     = "Pos1",
                Name     = "Position1",
                Value    = 12345,
                Mandates = new List <MandateVM>
                {
                    new MandateVM {
                        Allocation = .105m, name = "Mandate1", Value = 1296
                    },
                    new MandateVM {
                        Allocation = .205m, name = "Mandate2", Value = 2531
                    },
                    new MandateVM {
                        Allocation = .305m, name = "Mandate3", Value = 3765
                    },
                    new MandateVM {
                        Allocation = .109m, name = "Mandate4", Value = 1346
                    },
                    new MandateVM {
                        Allocation = .025m, name = "Liquidity", Value = 309
                    }
                }
            };

            FundOfMandates fundOfMandates = new FundOfMandates
            {
                InstrumentCode      = "Pos1",
                InstrumentName      = "FundOfMandates1",
                LiquidityAllocation = 2.5m,
                Mandates            = new Mandate[]
                {
                    new Mandate {
                        Allocation = 10.5m, MandateId = "Mandate1", MandateName = "Mandate1"
                    },
                    new Mandate {
                        Allocation = 20.5m, MandateId = "Mandate2", MandateName = "Mandate2"
                    },
                    new Mandate {
                        Allocation = 30.5m, MandateId = "Mandate3", MandateName = "Mandate3"
                    },
                    new Mandate {
                        Allocation = 10.9m, MandateId = "Mandate4", MandateName = "Mandate4"
                    }
                }
            };


            var outputPos = fundsProcessor.GetCalculatedMandates(inputPosition, fundOfMandates);

            outputPos.Should().NotBeNull().And.BeOfType <PositionVM>().And.BeEquivalentTo(outputPosition);
            outputPos.Mandates.Should().HaveCount(5, "Because Liquidity should get added since we pass Liquidity allocation more than 0");
        }