public void TestLookupRecursive3() { fsm = new FinancialSecurityManager(securityLookupServices, combiner, true, false, cache); //Lookup using X fsm.Lookup("X"); //Lookup again using X SecurityData sdx = fsm.Lookup("X"); //Lookup using Y SecurityData sdy = fsm.Lookup("Y"); //The returned securityData for X must be the same one as that in cache. ICache cacheField = (ICache)UnitTestHelper.GetPrivateFieldValue(fsm, "securityDataCache"); Assert.AreEqual(UnitTestHelper.GetPrivateFieldValue(cacheField["X"], "securityData"), sdx, "Wrong Lookup implementation."); Assert.AreEqual(UnitTestHelper.GetPrivateFieldValue(cacheField["Y"], "securityData"), sdy, "Wrong Lookup implementation."); }
public void TestLookupRecursive2() { fsm = new FinancialSecurityManager(securityLookupServices, combiner, true, false, cache); //Lookup using X SecurityData securityData = fsm.Lookup("X"); //Returned data must have reference ids X,Y Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "X", "Y" }), "Wrong Lookup implementation."); }
public void TestLookupSimple1() { fsm = new FinancialSecurityManager(securityLookupServices, combiner, false, false, cache); //Lookup using A SecurityData securityData = fsm.Lookup("A"); //Returned data must have reference ids A,B,C Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C" }), "Wrong Lookup implementation."); ICache cacheField = (ICache)UnitTestHelper.GetPrivateFieldValue(fsm, "securityDataCache"); UnitTestHelper.CheckSecurityDataRecord(cacheField, "A", new string[] { "A", "B", "C" }, true); UnitTestHelper.CheckSecurityDataRecord(cacheField, "B", new string[] { "A", "B", "C" }, false); UnitTestHelper.CheckSecurityDataRecord(cacheField, "C", new string[] { "A", "B", "C" }, false); }
public void TestLookupFail4() { securityLookupServices.Remove(SecurityIdType.SymbolTicker); fsm = new FinancialSecurityManager(securityLookupServices, combiner, true, false, cache); fsm.Lookup("A"); }
public void TestLookupReference1() { //Lookup using A SecurityData securityData = fsm.Lookup("A"); //Returned data must have reference ids A,B,C Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C" }), "Wrong Lookup implementation."); ICache cache = (ICache)UnitTestHelper.GetPrivateFieldValue(fsm, "securityDataCache"); UnitTestHelper.CheckSecurityDataRecord(cache, "A", new string[] { "A", "B", "C" }, true); UnitTestHelper.CheckSecurityDataRecord(cache, "B", new string[] { "A", "B", "C" }, false); UnitTestHelper.CheckSecurityDataRecord(cache, "C", new string[] { "A", "B", "C" }, false); }
public void DemoLookup() { //////////////REFERENCE LOOKUP DEMO fsm = new FinancialSecurityManager(securityLookupServices, combiner, false, true, cache); //Lookup using A. Returns A,B,C SecurityData securityData = fsm.Lookup("A"); //Returned data must have reference ids A,B,C Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C" }), "Wrong Lookup implementation."); //Now lookup using B securityData = fsm.Lookup("B"); //Returned data must have reference ids A,B,C,D Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C", "D" }), "Wrong Lookup implementation."); //////////////SIMPLE LOOKUP DEMO cache = new SimpleCache(); fsm = new FinancialSecurityManager(securityLookupServices, combiner, false, false, cache); //Lookup using A. Returns A,B,C securityData = fsm.Lookup("A"); //Returned data must have reference ids A,B,C Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C" }), "Wrong Lookup implementation."); //Now lookup using B securityData = fsm.Lookup("B"); //Returned data must have reference ids A,B,C Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C" }), "Wrong Lookup implementation."); //////////////RECURSIVE LOOKUP DEMO cache = new SimpleCache(); fsm = new FinancialSecurityManager(securityLookupServices, combiner, true, false, cache); //Lookup using A. Returns A,B,C,D securityData = fsm.Lookup("A"); //Returned data must have reference ids A,B,C,D Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C", "D" }), "Wrong Lookup implementation."); //Now lookup using B securityData = fsm.Lookup("B"); //Returned data must have reference ids A,B,C,D Assert.IsTrue(UnitTestHelper.AreReferenceIdsEqual( securityData.ReferenceIds, new string[] { "A", "B", "C", "D" }), "Wrong Lookup implementation."); }