Exemple #1
0
            public void beforeAll()
            {
                //log4net.Config.XmlConfigurator.Configure(new FileInfo("bootstrap.log4net"));

                _userClarifySessionConfigurator = MockRepository.GenerateStub <IUserClarifySessionConfigurator>();
                _clarifyApplication             = MockRepository.GenerateStub <IClarifyApplication>();

                _userSessionStartObserver = MockRepository.GenerateStub <IUserSessionStartObserver>();
                _userSessionEndObserver   = MockRepository.GenerateStub <IUserSessionEndObserver>();

                _container = bootstrap_ioc.getContainer(c => { });
                _container.Configure(c =>
                {
                    c.For <IUserClarifySessionConfigurator>().Use(_userClarifySessionConfigurator);
                    c.For <IClarifyApplication>().Use(_clarifyApplication);
                    c.For <IUserSessionStartObserver>().Use(_userSessionStartObserver);
                    c.For <IUserSessionEndObserver>().Use(_userSessionEndObserver);
                });
                _cut = _container.GetInstance <ClarifySessionCache>();

                _settings = _container.GetInstance <DovetailDatabaseSettings>();

                //have to create a REAL session because a test fake just won't do
                _expectedSession = CreateRealSession();
            }
 public ClarifySessionCache(IClarifyApplication clarifyApplication, ILogger logger, IUserClarifySessionConfigurator sessionConfigurator, Func<IUserSessionEndObserver> sessionEndObserver, Func<IUserSessionStartObserver> sessionStartObserver, DovetailDatabaseSettings settings)
 {
     _clarifyApplication = clarifyApplication;
     _logger = logger;
     _sessionConfigurator = sessionConfigurator;
     _sessionEndObserver = sessionEndObserver;
     _sessionStartObserver = sessionStartObserver;
     _settings = settings;
 }
 public ClarifySessionCache(IClarifyApplication clarifyApplication, ILogger logger,
                            IUserClarifySessionConfigurator sessionConfigurator, Func <IUserSessionEndObserver> sessionEndObserver,
                            Func <IUserSessionStartObserver> sessionStartObserver, DovetailDatabaseSettings settings)
 {
     _clarifyApplication   = clarifyApplication;
     _logger               = logger;
     _sessionConfigurator  = sessionConfigurator;
     _sessionEndObserver   = sessionEndObserver;
     _sessionStartObserver = sessionStartObserver;
     _settings             = settings;
 }
        public override void Given()
        {
            _sessionsByUser = new Dictionary <string, IClarifySession>();
            _app            = MockFor <IClarifyApplication>();

            addMockSessionFor("annie", false);
            addMockSessionFor("hank", true);
            addMockSessionFor("sven", true);

            MockFor <IClarifySessionCache>().Stub(s => s.SessionsByUsername).Return(_sessionsByUser);
        }
 public ClarifySessionUsageReporter(IClarifySessionCache clarifySessionCache, IClarifyApplication clarifyApplication, ILogger logger)
 {
     _clarifySessionCache = clarifySessionCache;
     _clarifyApplication = clarifyApplication;
     _logger = logger;
 }
Exemple #6
0
        private static void InsertRecords(XmlDocument doc, ClarifyGeneric generic)
        {
            IClarifyApplication FCApp = ClarifyApplication.Instance;

            bool isValid = true;
            int  i       = 0;

            //	Loop for each address record in the xml file
            foreach (XmlNode address in doc.SelectNodes("//addresses/address"))
            {
                i++;

                //	Get values of attributes
                string address1 = GetAttributeValue(address, "address1", i);
                string address2 = GetAttributeValue(address, "address2", i);
                string city     = GetAttributeValue(address, "city", i);
                string state    = GetAttributeValue(address, "state", i);
                string zip      = GetAttributeValue(address, "zip", i);
                string country  = GetAttributeValue(address, "country", i);
                string timezone = GetAttributeValue(address, "timezone", i);

                //	Check to see if the country, timezone, and state are valid
                isValid = isValid & IsValid(country, timezone, state, i);

                //	Only add new rows if all previous rows are valid
                if (isValid)
                {
                    //	Add a new address row to the address generic
                    GenericDataRow row = generic.AddNew();

                    //	Set the field values of the new address row
                    row["address"]      = address1;
                    row["address_2"]    = address2;
                    row["city"]         = city;
                    row["state"]        = state;
                    row["zipcode"]      = zip;
                    row["update_stamp"] = DateTime.Now;

                    //	Relate this new row to existing records by relation and objid
                    row.RelateByID(FCApp.LocaleCache.GetCountryObjID(country), "address2country");
                    row.RelateByID(FCApp.LocaleCache.GetStateObjID(country, state), "address2state_prov");
                    row.RelateByID(FCApp.LocaleCache.GetTimeZoneObjID(timezone), "address2time_zone");
                }
            }

            try
            {
                //	If all the records are valid then commit new rows to the database
                if (isValid)
                {
                    //	Commit all the new rows to the database
                    generic.UpdateAll();
                    Console.WriteLine("Finished. Added {0} address records.", i);
                }
                else
                {
                    Console.WriteLine("No records were added due to invalid data.");
                }
            }
            catch (Exception ex)
            {
                // Error inserting rows
                Console.WriteLine("Error adding new addresses.\n{0}", ex.Message);
            }
        }
            public void beforeAll()
            {
                _userClarifySessionConfigurator = MockRepository.GenerateStub<IUserClarifySessionConfigurator>();
                _clarifyApplication = MockRepository.GenerateStub<IClarifyApplication>();

                _userSessionStartObserver = MockRepository.GenerateStub<IUserSessionStartObserver>();
                _userSessionEndObserver = MockRepository.GenerateStub<IUserSessionEndObserver>();

                _container = bootstrap_ioc.getContainer(c =>
                {
                    c.For<IUserClarifySessionConfigurator>().Use(_userClarifySessionConfigurator);
                    c.For<IClarifyApplication>().Use(_clarifyApplication);
                    c.For<IUserSessionStartObserver>().Use(_userSessionStartObserver);
                    c.For<IUserSessionEndObserver>().Use(_userSessionEndObserver);
                });

                _cut = _container.GetInstance<ClarifySessionCache>();

                _settings = _container.GetInstance<DovetailDatabaseSettings>();

                //have to create a REAL session because a test fake just won't do
                _expectedSession = CreateRealSession();
            }
 public UserAuthenticator(ILogger logger, IClarifyApplication clarifyApplication)
 {
     _logger = logger;
     //HACK to make sure SDK is spun up. ICK
     _clarifyApplication = clarifyApplication;
 }
 public ClarifySessionUsageReporter(IClarifySessionCache clarifySessionCache, IClarifyApplication clarifyApplication, ILogger logger)
 {
     _clarifySessionCache = clarifySessionCache;
     _clarifyApplication  = clarifyApplication;
     _logger = logger;
 }
 public UserAuthenticator(ILogger logger, IClarifyApplication clarifyApplication)
 {
     _logger = logger;
     //HACK to make sure SDK is spun up. ICK
     _clarifyApplication = clarifyApplication;
 }