Пример #1
0
        public void DemoFinancialSecurityManagerBuilder()
        {
            //Get IConfiguration object either by preparing it manually or
            //by using File Based Configuration TCS component
            IConfiguration config = UnitTestHelper.GetConfigObject();

            //Create the FinancialSecurityManager instance from IConfiguration
            FinancialSecurityManager fsm = FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);
        }
Пример #2
0
 public void TestBuildFinancialSecurityManagerFail6()
 {
     try
     {
         FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(null);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is SelfDocumentingException, "SelfDocumentingException is expected.");
         Assert.IsTrue(e.InnerException is ArgumentNullException,
                       "ArgumentNullException is expected.");
     }
 }
Пример #3
0
 public void TestBuildFinancialSecurityManagerFail2()
 {
     try
     {
         config.SetSimpleAttribute("objectfactory_key", "       ");
         FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is SelfDocumentingException, "SelfDocumentingException is expected.");
         Assert.IsTrue(e.InnerException is ConfigurationErrorsException,
                       "ConfigurationErrorsException is expected.");
     }
 }
Пример #4
0
 public void TestBuildFinancialSecurityManagerFail1()
 {
     try
     {
         config.RemoveAttribute("security_data_cache_key");
         FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is SelfDocumentingException, "SelfDocumentingException is expected.");
         Assert.IsTrue(e.InnerException is ConfigurationErrorsException,
                       "ConfigurationErrorsException is expected.");
     }
 }
Пример #5
0
 public void TestBuildFinancialSecurityManagerFail4()
 {
     try
     {
         config.SetAttribute("security_lookup_service_keys", new string[] { "  ", "ColdTurkey" });
         FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is SelfDocumentingException, "SelfDocumentingException is expected.");
         Assert.IsTrue(e.InnerException is ConfigurationErrorsException,
                       "ConfigurationErrorsException is expected.");
     }
 }
Пример #6
0
 public void TestBuildFinancialSecurityManagerFail5()
 {
     try
     {
         config.SetAttribute("security_id_types", new string[] { SecurityIdType.CUSIP, SecurityIdType.SEDOL });
         config.SetAttribute("security_lookup_service_keys",
                             new string[] { "object_customLookupService1",
                                            "object_customLookupService1", "object_customLookupService1" });
         FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is SelfDocumentingException, "SelfDocumentingException is expected.");
         Assert.IsTrue(e.InnerException is ConfigurationErrorsException,
                       "ConfigurationErrorsException is expected.");
     }
 }
Пример #7
0
        public void TestBuildFinancialSecurityManager()
        {
            FinancialSecurityManager fsm =
                FinancialSecurityManagerBuilder.BuildFinancialSecurityManager(config);

            //Check if objet has been created correctly.
            Assert.IsNotNull(UnitTestHelper.GetPrivateFieldValue(fsm, "securityIdParser"),
                             "Incorrect BuildFinancialSecurityManager implementation.");
            Assert.AreEqual((UnitTestHelper.GetPrivateFieldValue(fsm, "securityLookupServices")
                             as Dictionary <string, ISecurityLookupService>).Count, 2,
                            "Incorrect BuildFinancialSecurityManager implementation.");
            Assert.AreEqual(UnitTestHelper.GetPrivateFieldValue(fsm, "recursiveLookup"), true,
                            "Incorrect BuildFinancialSecurityManager implementation.");
            Assert.AreEqual(UnitTestHelper.GetPrivateFieldValue(fsm, "referenceLookup"), false,
                            "Incorrect BuildFinancialSecurityManager implementation.");
            Assert.IsNotNull(UnitTestHelper.GetPrivateFieldValue(fsm, "securityDataCache"),
                             "Incorrect BuildFinancialSecurityManager implementation.");
            Assert.IsNotNull(UnitTestHelper.GetPrivateFieldValue(fsm, "securityDataCombiner"),
                             "Incorrect BuildFinancialSecurityManager implementation.");
        }