public void RegisterFacebookClient_GivenOneRecord_Registers() { DatabaseMigrations.DeleteAndUpgradeDatabase(TestContext); var fixture = FixtureFactory.CreateFixture(); var faceBookAppCredential = fixture.Build <FaceBookAppCredential>().With(p => p.Active, true).CreateAnonymous(); ProoftedDbContext.Borrow(context => { context.FaceBookAppCredentials.Add( faceBookAppCredential); context.SaveChanges(); }); var mock = fixture.Freeze <Mock <IOAuthWebSecurity> >(); var reg = fixture.CreateAnonymous <OAuthRegistrar>(); reg.RegisterFacebookClient(); mock.Verify(p => p.RegisterFacebookClient(faceBookAppCredential.AppId, faceBookAppCredential.SecretKey)); }
public void TestInitialize() { DatabaseMigrations.DeleteAndUpgradeDatabase(this.TestContext); this._fixture = FixtureFactory.CreateFixture(); this._securityMock = this._fixture.CreateAnonymous <Mock <IWebSecurity> >(); this._security = new WebSecurityWrapper2(this._securityMock.Object); }
public void UpdateDatabase(Action <string> updateProgress) { try { DatabaseMigrations.RunDatabaseMigrations(this, updateProgress); } catch (DatabaseMigrationsException ex) { ReportCard.Errors.Add(ex.Message); } }
public void CanUpgradeDownGradeAndUpgradeTheDatabase() { DatabaseMigrations.DeleteAndUpgradeDatabase(TestContext); DatabaseMigrations.UpdateDatabase(TestContext, targetMigration: "0"); DatabaseMigrations.UpdateDatabase(TestContext); //var migrator = DatabaseMigrations.GetMigrator(this.TestContext); //migrator.Update(); //migrator.Update(targetMigration: "0"); //Down //migrator.Update(); //Up }
List <string> RunDataMigration(params string[] commands) { var progressLog = new List <string>(); var index = 0; DatabaseMigrations.RunDataMigration(s => { progressLog.Add(s); }, AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory, "DatabaseMigrationsTester.exe", () => { var nextCommand = commands[index % commands.Length]; index++; return(nextCommand); }); return(progressLog); }
public void RegisterFacebookClient_GivenZeroRecords_DoesNotRegister() { DatabaseMigrations.DeleteAndUpgradeDatabase(TestContext); var fixture = FixtureFactory.CreateFixture(); var mock = fixture.Freeze <Mock <IOAuthWebSecurity> >(); var reg = fixture.CreateAnonymous <OAuthRegistrar>(); reg.RegisterFacebookClient(); mock.Verify(p => p.RegisterFacebookClient(It.IsAny <string>(), It.IsAny <string>()), Times.Never()); Assert.AreEqual(0, mock.Object.RegisteredClientData.Count); }