public void ApplyCapitalReturnAddedEvent() { 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 events = mockRepository.Create <IEventList>(); var corporateActionList = new CorporateActionList(stock, events.Object); var id = Guid.NewGuid(); var @event = new CapitalReturnAddedEvent(stock.Id, 0, id, new Date(2000, 01, 01), "Test Capital Return", new Date(2000, 02, 01), 10.00m); corporateActionList.Apply(@event); corporateActionList.Should().SatisfyRespectively( first => first.Should().BeEquivalentTo(new { Id = id, Stock = stock, Date = new Date(2000, 01, 01), Description = "Test Capital Return", PaymentDate = new Date(2000, 02, 01), Amount = 10.00m }) ); mockRepository.Verify(); }
public void ApplySplitConsolidationAddedEvent() { 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 events = mockRepository.Create <IEventList>(); var corporateActionList = new CorporateActionList(stock, events.Object); var id = Guid.NewGuid(); var @event = new SplitConsolidationAddedEvent(stock.Id, 0, id, new Date(2000, 01, 01), "Test Split", 1, 2); corporateActionList.Apply(@event); corporateActionList.Should().SatisfyRespectively( first => first.Should().BeEquivalentTo(new { Id = id, Stock = stock, Date = new Date(2000, 01, 01), Description = "Test Split", OriginalUnits = 1, NewUnits = 2 }) ); mockRepository.Verify(); }
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(); }