//-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            CapitalIndexedBondTrade trade    = sut();
            PortfolioItemSummary    expected = PortfolioItemSummary.builder().id(TRADE_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.BOND).currencies(Currency.USD).description("Bond x 10").build();

            assertEquals(trade.summarize(), expected);
        }
        public virtual void test_withPrice()
        {
            CapitalIndexedBondTrade @base = sut();
            double price = 0.95;
            CapitalIndexedBondTrade computed = @base.withPrice(price);
            CapitalIndexedBondTrade expected = CapitalIndexedBondTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(price).build();

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_withQuantity()
        {
            CapitalIndexedBondTrade @base = sut();
            double quantity = 3456d;
            CapitalIndexedBondTrade computed = @base.withQuantity(quantity);
            CapitalIndexedBondTrade expected = CapitalIndexedBondTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(quantity).price(PRICE).build();

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            CapitalIndexedBondSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo tradeInfo = TradeInfo.builder().tradeDate(date(2016, 6, 30)).settlementDate(date(2016, 7, 1)).build();
            CapitalIndexedBondTrade expectedTrade = CapitalIndexedBondTrade.builder().info(tradeInfo).product(PRODUCT).quantity(100).price(123.50).build();

            assertEquals(test.createTrade(tradeInfo, 100, 123.50, ReferenceData.empty()), expectedTrade);
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            CapitalIndexedBondTrade test = sut();

            assertEquals(test.Info, TRADE_INFO);
            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Quantity, QUANTITY);
            assertEquals(test.Price, PRICE);
            assertEquals(test.withInfo(TRADE_INFO).Info, TRADE_INFO);
            assertEquals(test.withQuantity(129).Quantity, 129d, 0d);
            assertEquals(test.withPrice(129).Price, 129d, 0d);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CapitalIndexedBondTrade other = (CapitalIndexedBondTrade)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(quantity, other.quantity) && JodaBeanUtils.equal(price, other.price));
     }
     return(false);
 }
 internal static CapitalIndexedBondTrade sut2()
 {
     return(CapitalIndexedBondTrade.builder().info(TradeInfo.builder().tradeDate(START.plusDays(7)).build()).product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build());
 }
 internal static CapitalIndexedBondTrade sut1()
 {
     return(CapitalIndexedBondTrade.builder().info(TRADE_INFO).product(PRODUCT1).quantity(QUANTITY).price(PRICE).build());
 }
        public virtual void test_resolve_noTradeOrSettlementDate()
        {
            CapitalIndexedBondTrade test = CapitalIndexedBondTrade.builder().info(TradeInfo.empty()).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            assertThrows(() => test.resolve(REF_DATA), typeof(System.InvalidOperationException));
        }
        public virtual void test_resolve_invalid()
        {
            CapitalIndexedBondTrade test = sut().toBuilder().info(TRADE_INFO_EARLY).build();

            assertThrowsIllegalArg(() => test.resolve(REF_DATA));
        }