Esempio n. 1
0
 public static AwfulDataContext CreateDataContext(string name)
 {
     string connectionString = string.Format("{0}/{1}.sdf", DB_CONNECTION_PREFIX, name);
     AwfulDataContext context = null;
     context = new AwfulDataContext(connectionString);
     return context;
 }
Esempio n. 2
0
        public void Starting()
        {
            using (var db = AwfulDataContext.CreateDataContext(TEST_FILENAME))
            {
                if (db.DatabaseExists()) { db.DeleteDatabase(); }
                db.CreateDatabase();
            }

            using (var db = new AwfulDataContext())
            {
                if (!db.DatabaseExists())
                {
                    db.CreateDatabase();
                    var dao = new AwfulProfileDAO(db);
                    dao.CreateProfile(StaticParameters.TEST_USERNAME, StaticParameters.TEST_PASSWORD, new List<Cookie>());
                }
            }
        }
Esempio n. 3
0
        public void Started()
        {
            var dao = new AwfulProfileDAO();

            var testProfile = dao.GetProfileByUsername(StaticParameters.TEST_USERNAME);
            if (testProfile != null)
            {
                AwfulWebRequest.SetCookieJar(testProfile.GetTokensAsCookies());
                if (!AwfulWebRequest.CanAuthenticate)
                {
                    AwfulAuthenticateByBrowser.LoginSuccessful += (o, a) =>
                        {
                            dao.SaveAuthenticationCookiesToProfile(testProfile, a.Cookies);
                            dao.Dispose();
                        };
                }
            }

            TestContext = AwfulDataContext.CreateDataContext(TEST_FILENAME);
        }
Esempio n. 4
0
 private AwfulForumsDAO(AwfulDataContext context, bool disposable)
 {
     this._context = context;
     this._isDisposable = disposable;
 }
Esempio n. 5
0
 public AwfulForumsDAO(AwfulDataContext context)
     : this(context, false)
 {
 }
Esempio n. 6
0
        public void Dispose()
        {
            if (this._isDisposable)
            {
                this._context.Dispose();
            }

            this._context = null;
        }
Esempio n. 7
0
 private AwfulProfileDAO(AwfulDataContext context, Boolean isDisposable)
 {
     this._context = context;
     this._isDataContextDisposable = isDisposable;
 }
Esempio n. 8
0
 public AwfulProfileDAO(AwfulDataContext context)
     : this(context, false)
 {
 }