Esempio n. 1
0
        public void GetBaseValueSegment_MatchesId_ValidateNoInactiveBvsTransactions()
        {
            IBaseValueSegmentRepository baseValueSegmentRepository = new BaseValueSegmentRepository(_context);
            var baseValueSegment = baseValueSegmentRepository.Get(BvsId);
            int bvsTransCount    = baseValueSegment.BaseValueSegmentTransactions.Count;

            //Add an Active Transaction
            var testBvsTrans = new BaseValueSegmentTransaction
            {
                Id = BvsTranId + 1,
                BaseValueSegmentId = BvsId,
                TransactionId      = 0,
                EffectiveStatus    = "A",
                BaseValueSegmentTransactionTypeId = 2,
                DynCalcStepTrackingId             = -100,
                BaseValueSegmentOwners            = new List <BaseValueSegmentOwner>(),
                BaseValueSegmentValueHeaders      = new List <BaseValueSegmentValueHeader>()
            };

            _context.BaseValueSegmentTransactions.Add(testBvsTrans);
            _context.SaveChanges();
            baseValueSegment = baseValueSegmentRepository.Get(BvsId);
            int updatedBvsTransCount = baseValueSegment.BaseValueSegmentTransactions.Count;

            bvsTransCount.ShouldBeLessThan(updatedBvsTransCount);

            //Add an Inactive Transaction
            testBvsTrans = new BaseValueSegmentTransaction
            {
                Id = BvsTranId + 2,
                BaseValueSegmentId = BvsId,
                TransactionId      = 0,
                EffectiveStatus    = "A",
                BaseValueSegmentTransactionTypeId = UserDeletedTransactionId(),
                DynCalcStepTrackingId             = -100,
                BaseValueSegmentOwners            = new List <BaseValueSegmentOwner>(),
                BaseValueSegmentValueHeaders      = new List <BaseValueSegmentValueHeader>()
            };
            _context.BaseValueSegmentTransactions.Add(testBvsTrans);
            _context.SaveChanges();
            baseValueSegment = baseValueSegmentRepository.Get(BvsId);
            int newBvsTransCount = baseValueSegment.BaseValueSegmentTransactions.Count;

            updatedBvsTransCount.ShouldBe(newBvsTransCount);
        }
Esempio n. 2
0
        public BaseValueSegmentRepositoryTests()
        {
            var optionsBuilder = new DbContextOptionsBuilder <BaseValueSegmentQueryContext>();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString("N"));

            _context = new BaseValueSegmentQueryContext(optionsBuilder.Options);

            var baseValueSegmentTransaction = new BaseValueSegmentTransaction
            {
                Id = BvsTranId,
                BaseValueSegmentId = BvsId,
                TransactionId      = 0,
                EffectiveStatus    = "A",
                BaseValueSegmentTransactionTypeId = 2,
                DynCalcStepTrackingId             = -100,
                BaseValueSegmentOwners            = new List <BaseValueSegmentOwner>(),
                BaseValueSegmentValueHeaders      = new List <BaseValueSegmentValueHeader>()
            };

            var baseValueSegmentOwner = new BaseValueSegmentOwner
            {
                Id = BvsOwnerId,
                BaseValueSegmentTransactionId = BvsTranId,
                LegalPartyRoleId          = 0,
                BeneficialInterestPercent = 50,
                DynCalcStepTrackingId     = 0,
                GRMEventId      = EventId,
                AlphaBVSOwnerId = null,
                BaseValueSegmentOwnerValueValues = new List <BaseValueSegmentOwnerValue>()
            };

            var baseValueSegmentValueHeader = new BaseValueSegmentValueHeader
            {
                Id = BvsValueHeaderId,
                BaseValueSegmentTransactionId = BvsTranId,
                BaseYear = 2015,
                DynCalcStepTrackingId  = 0,
                BaseValueSegmentValues = new List <BaseValueSegmentValue>()
            };

            var baseValueSegmentValue = new BaseValueSegmentValue
            {
                Id = BvsValueId,
                BaseValueSegmentValueHeaderId = BvsValueHeaderId,
                SubComponent          = 1,
                ValueAmount           = 110000,
                PercentComplete       = 75,
                FullValueAmount       = 120000,
                DynCalcStepTrackingId = 0,
            };

            var baseValueSegmentOwnerValue = new BaseValueSegmentOwnerValue
            {
                Id = BvsOwnerValueId,
                BaseValueSegmentOwnerId = BvsOwnerValueId,
                BaseValue             = 100000,
                DynCalcStepTrackingId = 0,
            };

            var baseValueSegment = new Models.V1.BaseValueSegment
            {
                Id                    = BvsId,
                AsOf                  = AssessmentEventDate,
                TransactionId         = 0,
                RevenueObjectId       = RevObjId,
                SequenceNumber        = 1,
                DynCalcInstanceId     = 0,
                DynCalcStepTrackingId = 0
            };

            baseValueSegmentOwner.BaseValueSegmentOwnerValueValues.Add(baseValueSegmentOwnerValue);
            baseValueSegmentValueHeader.BaseValueSegmentValues.Add(baseValueSegmentValue);
            baseValueSegmentTransaction.BaseValueSegmentOwners.Add(baseValueSegmentOwner);
            baseValueSegmentTransaction.BaseValueSegmentValueHeaders.Add(baseValueSegmentValueHeader);
            baseValueSegment.BaseValueSegmentTransactions.Add(baseValueSegmentTransaction);

            _context.Add(baseValueSegment);

            var userDeletedTransaction = new BaseValueSegmentTransactionType
            {
                Id          = 1,
                Name        = "User Deleted",
                Description = "User Deleted"
            };

            _context.Add(userDeletedTransaction);
            var userTransactionType = new BaseValueSegmentTransactionType
            {
                Id          = 2,
                Name        = "User",
                Description = "User"
            };

            _context.Add(userTransactionType);


            var beneficialInterestInfo = new BeneficialInterestInfo
            {
                LegalPartyId                 = 100,
                GrmEventId                   = 200,
                EventDate                    = new DateTime(2015, 1, 1),
                EventType                    = "Transfer",
                EffectiveDate                = new DateTime(2015, 2, 1),
                DocNumber                    = "UnitTestDoc",
                DocType                      = "Deed",
                DocDate                      = new DateTime(2015, 3, 1),
                OwnerId                      = 300,
                OwnerName                    = "Unit Test Owner",
                LegalPartyRoleId             = 400,
                BeneficialInterestPercentage = 50,
                PercentageInterestGain       = 25
            };

            _context.Add(beneficialInterestInfo);

            _context.SaveChanges();
        }