Пример #1
0
        public void Amount_Annotate_DoesNothingIfNoCOmmodity()
        {
            Amount amount1 = new Amount(10, null);

            amount1.Annotate(new Annotation());
            Assert.IsFalse(amount1.HasAnnotation);
        }
Пример #2
0
        public void Amount_Annotate_CreatesAnnotatedCommodityForNonAnnotated()
        {
            Commodity commodity1 = new Commodity(CommodityPool.Current, new CommodityBase("base-1"));
            Amount    amount1    = new Amount(10, commodity1);

            Assert.IsFalse(amount1.Commodity.IsAnnotated);
            amount1.Annotate(new Annotation());

            Assert.IsTrue(amount1.HasAnnotation);
            Assert.IsTrue(amount1.Commodity.IsAnnotated);
        }
Пример #3
0
        public void Amount_Annotate_CreatesNewAnnotatedCommodityForAnnotated()
        {
            Commodity          commodity1          = new Commodity(CommodityPool.Current, new CommodityBase("aac-base-1"));
            AnnotatedCommodity annotatedCommodity1 = new AnnotatedCommodity(commodity1, new Annotation());
            Amount             amount1             = new Amount(10, annotatedCommodity1);
            Annotation         newAnnotation       = new Annotation();

            Assert.IsTrue(amount1.Commodity.IsAnnotated);
            amount1.Annotate(newAnnotation);

            Assert.IsTrue(amount1.HasAnnotation);
            Assert.IsTrue(amount1.Commodity.IsAnnotated);

            AnnotatedCommodity resultCommodity = (AnnotatedCommodity)amount1.Commodity;

            Assert.AreEqual(newAnnotation, resultCommodity.Details);
        }
Пример #4
0
        public void Amount_Annotate_FailsIfNoQuantity()
        {
            Amount amount1 = new Amount(Quantity.Empty, null);

            amount1.Annotate(new Annotation());
        }
Пример #5
0
        public void Amount_Annotate_FailsIfNoQuantity()
        {
            Amount amount1 = new Amount(Quantity.Empty, null);

            Assert.Throws <AmountError>(() => amount1.Annotate(new Annotation()));
        }
Пример #6
0
        public void Amount_Annotate_FailsIfNoQuantity()
        {
            Amount amount1 = new Amount(new BigInt(), null);

            amount1.Annotate(new Annotation());
        }