Beispiel #1
0
 public static OwnerDto ToOwner(this BaseValueSegmentOwnerDto owner)
 {
     return(new OwnerDto
     {
         // ReSharper disable once PossibleInvalidOperationException
         OwnerId = owner.Id.Value,
         BiPercentage = owner.BeneficialInterestPercent,
         LegalPartyRoleId = owner.LegalPartyRoleId
     });
 }
        public void PopulateToOwner()
        {
            var owner = new BaseValueSegmentOwnerDto
            {
                Id = 2,
                BeneficialInterestPercent = 64
            };

            var dto = owner.ToOwner();

            dto.OwnerId.ShouldBe(2);
            dto.BiPercentage.ShouldBe(64);
        }
        private BaseValueSegmentDto MockData()
        {
            var owner1 = new BaseValueSegmentOwnerDto {
                GRMEventId = 101
            };
            var owner2 = new BaseValueSegmentOwnerDto();
            var owner3 = new BaseValueSegmentOwnerDto {
                GRMEventId = 202
            };                                                        // Testing the distint part of the query
            var owner4 = new BaseValueSegmentOwnerDto {
                GRMEventId = 202
            };

            var transaction = new BaseValueSegmentTransactionDto();

            transaction.BaseValueSegmentOwners.Add(owner1);
            transaction.BaseValueSegmentOwners.Add(owner2);
            transaction.BaseValueSegmentOwners.Add(owner3);
            transaction.BaseValueSegmentOwners.Add(owner4);

            var header1 = new BaseValueSegmentValueHeaderDto {
                GRMEventId = 400
            };
            var header2 = new BaseValueSegmentValueHeaderDto();
            var header3 = new BaseValueSegmentValueHeaderDto {
                GRMEventId = 510
            };                                                               // Testing the distint part of the query
            var header4 = new BaseValueSegmentValueHeaderDto {
                GRMEventId = 510
            };
            var header5 = new BaseValueSegmentValueHeaderDto {
                GRMEventId = 202
            };

            transaction.BaseValueSegmentValueHeaders.Add(header1);
            transaction.BaseValueSegmentValueHeaders.Add(header2);
            transaction.BaseValueSegmentValueHeaders.Add(header3);
            transaction.BaseValueSegmentValueHeaders.Add(header4);
            transaction.BaseValueSegmentValueHeaders.Add(header5);

            var baseValueSegmentDto = new BaseValueSegmentDto
            {
                RevenueObjectId = 4565,
                AsOf            = new DateTime(2011, 8, 1)
            };

            baseValueSegmentDto.BaseValueSegmentTransactions.Add(transaction);
            return(baseValueSegmentDto);
        }
        public void PopulateOwnerFromDocument()
        {
            var list = new List <LegalPartyDocumentDto>
            {
                new LegalPartyDocumentDto
                {
                    LegalPartyRoleId      = 18,
                    GrmEventId            = 1,
                    DocNumber             = "foodocnum1",
                    LegalPartyDisplayName = "fooname1",
                    DocType = "footype1",
                    PctGain = 40
                },
                new LegalPartyDocumentDto
                {
                    LegalPartyRoleId      = 11,
                    GrmEventId            = 1,
                    DocNumber             = "foodocnum2",
                    LegalPartyDisplayName = "fooname2",
                    DocType = "footype2",
                    PctGain = 10
                },
                new LegalPartyDocumentDto
                {
                    LegalPartyRoleId      = 12,
                    GrmEventId            = 1,
                    DocNumber             = "foodocnum3",
                    LegalPartyDisplayName = "fooname3",
                    DocType = "footype3",
                    PctGain = 60
                }
            };

            var bvsOwner = new BaseValueSegmentOwnerDto()
            {
                LegalPartyRoleId = 12,
                GRMEventId       = 1
            };

            var owner = new OwnerDto();

            list.PopulateOwner(owner, bvsOwner);
            owner.BeneficialInterest.ShouldBe("fooname3");
            owner.DocNumber.ShouldBe("foodocnum3");
            owner.DocType.ShouldBe("footype3");
            owner.PercentageInterestGain.ShouldBe(60);
        }
Beispiel #5
0
        public static void PopulateOwner(this List <LegalPartyDocumentDto> documents, OwnerDto ownerDto, BaseValueSegmentOwnerDto bvsOwner)
        {
            var allTheOwnersDocuments = documents.Where(x => x.LegalPartyRoleId == bvsOwner.LegalPartyRoleId);

            var ownerSpecificEventDocument = allTheOwnersDocuments.SingleOrDefault(x => x.GrmEventId == bvsOwner.GRMEventId);

            if (ownerSpecificEventDocument != null)
            {
                ownerDto.BeneficialInterest     = ownerSpecificEventDocument.LegalPartyDisplayName;
                ownerDto.DocNumber              = ownerSpecificEventDocument.DocNumber;
                ownerDto.DocType                = ownerSpecificEventDocument.DocType;
                ownerDto.PercentageInterestGain = ownerSpecificEventDocument.PctGain;
            }
            else
            {
                ownerDto.BeneficialInterest     = string.Empty;
                ownerDto.DocNumber              = Constants.DocumentUnknownName;
                ownerDto.DocType                = string.Empty;
                ownerDto.PercentageInterestGain = null;
            }
        }
Beispiel #6
0
        public static BaseValueSegmentDto MockData(this Mock <IBaseValueSegmentProvider> baseValueSegmentProvider, MockData mockData)
        {
            var ownerValueDtos = new List <BaseValueSegmentOwnerValueDto>();

            var owner = new BaseValueSegmentOwnerDto
            {
                Id = mockData.OwnerId,
                LegalPartyRoleId                 = 333,
                BeneficialInterestPercent        = mockData.BeneficialInterestPercentage,
                BaseValueSegmentOwnerValueValues = ownerValueDtos
            };

            ownerValueDtos.Add(new BaseValueSegmentOwnerValueDto
            {
                BaseValue = 100,
                BaseValueSegmentOwnerId       = mockData.OwnerId,
                BaseValueSegmentValueHeaderId = 1
            });

            var baseValueSegmentDto = new BaseValueSegmentDto
            {
                Id             = mockData.BaseValueSegmentId,
                AsOf           = mockData.EventDate,
                SequenceNumber = 1,
                BaseValueSegmentTransactions = new List <BaseValueSegmentTransactionDto>
                {
                    new BaseValueSegmentTransactionDto
                    {
                        Id = 31,
                        BaseValueSegmentOwners = new List <BaseValueSegmentOwnerDto>
                        {
                            owner
                        },
                        BaseValueSegmentTransactionType = new BaseValueSegmentTransactionTypeDto
                        {
                            Description = "BaseValueSegmentTransactionTypeDescription",
                            Name        = "BaseValueSegmentTransactionTypeName"
                        }
                    }
                }
            };

            var legalPartyDocuments = new List <LegalPartyDocumentDto>
            {
                new LegalPartyDocumentDto
                {
                    LegalPartyRoleId      = 333,
                    LegalPartyDisplayName = mockData.DisplayName,
                    DocNumber             = mockData.DocumentNumber,
                    DocType = mockData.DocumentType,
                    PctGain = mockData.PercentageInterestGain
                }
            };

            mockData.LegalPartyDomain.Setup(x => x.GetLegalPartyRoleDocuments(baseValueSegmentDto)).Returns(Task.FromResult <IEnumerable <LegalPartyDocumentDto> >(legalPartyDocuments));

            var events = new List <GrmEventInformationDto>
            {
                new GrmEventInformationDto
                {
                    Description = mockData.GrmEventDescription,
                    EventType   = mockData.GrmEventType,
                    EventDate   = mockData.GrmEventDate
                }
            };

            mockData.GrmEventDomain
            .Setup(x => x.GetOwnerGrmEvents(It.Is <BaseValueSegmentDto>(y => y.Id == mockData.BaseValueSegmentId)))
            .Returns(Task.FromResult <IEnumerable <GrmEventInformationDto> >(events));

            var tuple = new Tuple <BaseValueSegmentDto, BaseValueSegmentDto>(baseValueSegmentDto, null);

            baseValueSegmentProvider.Setup(x => x.GetCurrentAndPrevious(It.IsAny <int>()))
            .Returns(Task.FromResult(tuple));

            return(baseValueSegmentDto);
        }