public void Amount_Annotate_DoesNothingIfNoCOmmodity() { Amount amount1 = new Amount(10, null); amount1.Annotate(new Annotation()); Assert.IsFalse(amount1.HasAnnotation); }
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); }
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); }
public void Amount_Annotate_FailsIfNoQuantity() { Amount amount1 = new Amount(Quantity.Empty, null); amount1.Annotate(new Annotation()); }
public void Amount_Annotate_FailsIfNoQuantity() { Amount amount1 = new Amount(Quantity.Empty, null); Assert.Throws <AmountError>(() => amount1.Annotate(new Annotation())); }
public void Amount_Annotate_FailsIfNoQuantity() { Amount amount1 = new Amount(new BigInt(), null); amount1.Annotate(new Annotation()); }