Пример #1
0
        private CorporateAction CorporateActionFromEvent(TransformationAddedEvent @event)
        {
            var transformationResultingStocks = @event.ResultingStocks.Select(x => new Transformation.ResultingStock(x.Stock, x.OriginalUnits, x.NewUnits, x.CostBasePercentage, x.AquisitionDate));
            var transformation = new Transformation(@event.ActionId, Stock, @event.ActionDate, @event.Description, @event.ImplementationDate, @event.CashComponent, @event.RolloverRefliefApplies, transformationResultingStocks);

            return(transformation);
        }
Пример #2
0
        public void AddTransformation(Guid id, Date recordDate, string description, Date implementationDate, decimal cashComponent, bool rolloverReliefApplies, IEnumerable <Transformation.ResultingStock> resultingStocks)
        {
            if (description == "")
            {
                description = "Transformation";
            }

            var eventResultingStocks = resultingStocks.Select(x => new TransformationAddedEvent.ResultingStock(x.Stock, x.OriginalUnits, x.NewUnits, x.CostBasePercentage, x.AquisitionDate));
            var @event = new TransformationAddedEvent(_Stock.Id, _Stock.Version, id, recordDate, description, implementationDate, cashComponent, rolloverReliefApplies, eventResultingStocks);

            Apply(@event);
            PublishEvent(@event);
        }
        public void ApplyTransformationAddedEvent()
        {
            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 stock2 = new Stock(Guid.NewGuid());

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

            var events = mockRepository.Create <IEventList>();
            var corporateActionList = new CorporateActionList(stock, events.Object);

            var id           = Guid.NewGuid();
            var resultStocks = new TransformationAddedEvent.ResultingStock[] {
                new TransformationAddedEvent.ResultingStock(stock2.Id, 1, 2, 0.40m, new Date(2020, 02, 01))
            };
            var @event = new TransformationAddedEvent(stock.Id, 0, id, new Date(2000, 01, 01), "Test Transformation", new Date(2000, 02, 01), 1.20m, false, resultStocks);

            corporateActionList.Apply(@event);

            corporateActionList.Should().SatisfyRespectively(

                first => {
                first.Should().BeEquivalentTo(new
                {
                    Id                     = id,
                    Stock                  = stock,
                    Date                   = new Date(2000, 01, 01),
                    Description            = "Test Transformation",
                    CashComponent          = 1.20M,
                    RolloverRefliefApplies = false
                });
                first.Should().BeOfType <Transformation>().Which.ResultingStocks.Should().HaveCount(1);
            }

                );
            mockRepository.Verify();
        }