public void CommodityPool_FindOrCreateByCommodityAndDetails_CreatesAnnotatedCommodity() { TestCommodityPool commodityPool = new TestCommodityPool(); string symbol = "symbol"; Annotation details = new Annotation(); Commodity commodity = commodityPool.Create(symbol); AnnotatedCommodity annotatedCommodity = commodityPool.FindOrCreate(commodity, details) as AnnotatedCommodity; Assert.NotNull(annotatedCommodity); Assert.Equal(details, annotatedCommodity.Details); AnnotatedCommodity annotatedCommodity2 = commodityPool.FindOrCreate(commodity, details) as AnnotatedCommodity; Assert.Equal(annotatedCommodity, annotatedCommodity2); }
public void CommodityPool_FindWithAnnotation_IgnoresAnnotationFlags() { TestCommodityPool commodityPool = new TestCommodityPool(); string symbol = "symbol"; Annotation details = new Annotation(); Commodity commodity = commodityPool.Create(symbol); AnnotatedCommodity annotatedCommodity = commodityPool.FindOrCreate(commodity, details) as AnnotatedCommodity; // The same annotation but with another flags - annotated commodity is found Annotation details1 = new Annotation() { IsPriceFixated = true }; Assert.NotNull(commodityPool.Find(symbol, details1)); // Another annotation - no results Annotation details2 = new Annotation() { Tag = "tag" }; Assert.Null(commodityPool.Find(symbol, details2)); }