コード例 #1
0
        public void HasBeenApplied()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var stock = new Stock(Guid.NewGuid());

            stock.List("ABC", "ABC Pty Ltd", new Date(1974, 01, 01), false, AssetCategory.AustralianStocks);

            var splitConsolidation = new SplitConsolidation(Guid.NewGuid(), stock, new Date(2020, 01, 01), "Test SplitConsolidation", 1, 2);

            var transaction = new UnitCountAdjustment()
            {
                Id            = Guid.NewGuid(),
                Date          = new Date(2020, 02, 01),
                Stock         = stock,
                Comment       = "Test Unit Count Adjustment",
                OriginalUnits = 1,
                NewUnits      = 2
            };
            var transactions = mockRepository.Create <IPortfolioTransactionList>();

            transactions.Setup(x => x.ForHolding(stock.Id, splitConsolidation.Date)).Returns(new IPortfolioTransaction[] { transaction });

            var result = splitConsolidation.HasBeenApplied(transactions.Object);

            result.Should().BeTrue();

            mockRepository.Verify();
        }
コード例 #2
0
        public void HasBeenAppliedNoTransactionsAtRecordDate()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var stock = new Stock(Guid.NewGuid());

            stock.List("ABC", "ABC Pty Ltd", new Date(1974, 01, 01), false, AssetCategory.AustralianStocks);

            var splitConsolidation = new SplitConsolidation(Guid.NewGuid(), stock, new Date(2020, 01, 01), "Test SplitConsolidation", 1, 2);

            var transactions = mockRepository.Create <IPortfolioTransactionList>();

            transactions.Setup(x => x.ForHolding(stock.Id, splitConsolidation.Date)).Returns(new IPortfolioTransaction[] { });

            var result = splitConsolidation.HasBeenApplied(transactions.Object);

            result.Should().BeFalse();

            mockRepository.Verify();
        }
コード例 #3
0
        public void HasBeenAppliedNoSplitAtRecordDate()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var stock = new Stock(Guid.NewGuid());

            stock.List("ABC", "ABC Pty Ltd", new Date(1974, 01, 01), false, AssetCategory.AustralianStocks);

            var splitConsolidation = new SplitConsolidation(Guid.NewGuid(), stock, new Date(2020, 01, 01), "Test SplitConsolidation", 1, 2);

            var transaction = new IncomeReceived()
            {
                Id                    = Guid.NewGuid(),
                Date                  = new Date(2020, 02, 01),
                Stock                 = stock,
                Comment               = "Test Dividend",
                RecordDate            = new Date(2020, 01, 01),
                FrankedAmount         = 10.00m,
                UnfrankedAmount       = 20.00m,
                FrankingCredits       = 30.00m,
                Interest              = 40.00m,
                TaxDeferred           = 0.00m,
                CreateCashTransaction = false,
                DrpCashBalance        = 0.00m
            };

            var transactions = mockRepository.Create <IPortfolioTransactionList>();

            transactions.Setup(x => x.ForHolding(stock.Id, splitConsolidation.Date)).Returns(new IPortfolioTransaction[] { transaction });

            var result = splitConsolidation.HasBeenApplied(transactions.Object);

            result.Should().BeFalse();

            mockRepository.Verify();
        }