public void AddCompositeActionChildActions() { 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>(); events.Setup(x => x.Add(It.IsAny <CompositeActionAddedEvent>())).Verifiable(); var corporateActionList = new CorporateActionList(stock, events.Object); var id = Guid.NewGuid(); corporateActionList.StartCompositeAction(id, new Date(2000, 01, 01), "Test CompositeAction") .AddCapitalReturn("Capital Return", new Date(2000, 02, 01), 10.00m) .AddSplitConsolidation("Split", 1, 2) .Finish(); corporateActionList.Should().SatisfyRespectively( first => { first.Should().BeEquivalentTo(new { Id = id, Stock = stock, Date = new Date(2000, 01, 01), Description = "Test CompositeAction" }); first.Should().BeOfType <CompositeAction>().Which.ChildActions.Should().SatisfyRespectively( child1 => child1.Should().BeOfType <CapitalReturn>().Which.Amount.Should().Be(10.00m), child1 => child1.Should().BeOfType <SplitConsolidation>().Which.NewUnits.Should().Be(2) ); } ); mockRepository.Verify(); }
public void AddCompositeActionWithBlankDescription() { 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>(); events.Setup(x => x.Add(It.IsAny <CompositeActionAddedEvent>())).Verifiable(); var corporateActionList = new CorporateActionList(stock, events.Object); var id = Guid.NewGuid(); corporateActionList.StartCompositeAction(id, new Date(2000, 01, 01), "").Finish(); corporateActionList.Should().SatisfyRespectively( first => { first.Should().BeEquivalentTo(new { Id = id, Stock = stock, Date = new Date(2000, 01, 01), Description = "Complex corporate action" }); first.Should().BeOfType <CompositeAction>().Which.ChildActions.Should().BeEmpty(); } ); mockRepository.Verify(); }