Ejemplo n.º 1
0
 public void BasketBasics()
 {
     BasketImpl mb = new BasketImpl();
     
     Assert.That(mb != null);
     SecurityImpl i = new SecurityImpl("IBM");
     mb = new BasketImpl(i);
     mb.SendDebugEvent += new DebugDelegate(rt.d);
     Assert.That(mb.isNotEmpty);
     Assert.That(mb.isSecurityPresent(i), "missing ibm security");
     Assert.That(mb.isSymbolPresent("IBM"), "missing ibm symbol");
     Assert.IsFalse(mb.isSymbolPresent("LVS"), "had lvs before added");
     mb.Remove(i);
     Assert.That(!mb.isNotEmpty);
     mb.Add(new SecurityImpl("LVS"));
     Assert.That(mb[0].symbol=="LVS",mb[0].ToString());
     mb.Add(new SecurityImpl("IBM"));
     Assert.That(mb[1].symbol=="IBM");
     mb.Add("CLV8 FUT NYMEX");
     Assert.AreEqual(3, mb.Count,"missing futures symbol");
     Assert.IsTrue(mb[1].Type == SecurityType.STK, "not a equities type:" + mb[1].Type);
     Assert.IsTrue(mb[2].Type == SecurityType.FUT, "not a futures type:"+mb[2].Type);
     Security ts;
     Assert.IsTrue(mb.TryGetSecurityAnySymbol("IBM", out ts), "ibm fetch failed");
     Assert.IsTrue(mb.TryGetSecurityAnySymbol("LVS", out ts), "lvs fetch failed");
     Assert.IsTrue(mb.TryGetSecurityAnySymbol("CLV8", out ts), "CLV8 short fetch failed");
     Assert.IsTrue(mb.TryGetSecurityAnySymbol("CLV8 NYMEX FUT", out ts), "CLV8 short fetch failed");
     BasketImpl newbasket = new BasketImpl(new SecurityImpl("FDX"));
     newbasket.Add(mb);
     var orgcount = mb.Count;
     mb.Clear();
     Assert.That(mb.Count==0,"basket clear did not work");
     Assert.AreEqual(orgcount+1,newbasket.Count,"new basket missing symbols");
 }