예제 #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;
 }
예제 #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>());
                }
            }
        }
예제 #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);
        }
예제 #4
0
 private AwfulForumsDAO(AwfulDataContext context, bool disposable)
 {
     this._context = context;
     this._isDisposable = disposable;
 }
예제 #5
0
 public AwfulForumsDAO(AwfulDataContext context)
     : this(context, false)
 {
 }
예제 #6
0
        public void Dispose()
        {
            if (this._isDisposable)
            {
                this._context.Dispose();
            }

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