public async Task ScriptProviderShouldReturnAllFiles() { ScriptProvider sp = new ScriptProvider(); var scripts = await sp.GetScripts("C:\\Projects\\Testing\\Database\\Programmability", Depth.AllChilds); Debug.WriteLine($"Number of scripts: {scripts.Count()}"); }
public void ShouldLogAnErrorWhenUpgradeFails() { var ex = new InvalidOperationException(); ScriptProvider.GetScripts(Arg.Any <Func <IDbConnection> >()).Returns(provider => { throw ex; }); DbUpgrader.PerformUpgrade(); Log.Received().WriteError("Upgrade failed due to an unexpected exception:\r\n{0}", ex.ToString()); }
public void ShouldReturnFailedResult() { var ex = new InvalidOperationException(); ScriptProvider.GetScripts(Arg.Any <Func <IDbConnection> >()).Returns(provider => { throw ex; }); var result = DbUpgrader.PerformUpgrade(); Assert.That(result.Successful == false); Assert.That(result.Scripts.Count() == 0); Assert.That(result.Error == ex); }
public override void BeforeEach() { base.BeforeEach(); AllScripts = new List <SqlScript> { new SqlScript("0001.southwind.sql", "--LITTLE BOBBY DROP TABLES WAS HERE."), new SqlScript("0002.southwind.sql", "CREATE TABLE USERS --AGAIN") }; ScriptProvider.GetScripts(Arg.Any <Func <IDbConnection> >()).Returns(AllScripts); VersionTracker.GetExecutedScripts().Returns(new[] { "0001.southwind.sql" }); }
public override void BeforeEach() { base.BeforeEach(); AllScripts = new List <SqlScript> { new SqlScript("0001.sql", "CREATE TABLE $sometable$ (Id int)") }; ScriptProvider.GetScripts(Arg.Any <Func <IDbConnection> >()).Returns(AllScripts); VersionTracker.GetExecutedScripts().Returns(new string[0]); }
public override void BeforeEach() { base.BeforeEach(); AllScripts = new List <SqlScript> { new SqlScript("0001.sql", ""), new SqlScript("0004.sql", ""), new SqlScript("0002.sql", "") }; ScriptProvider.GetScripts(Arg.Any <Func <IDbConnection> >()).Returns(AllScripts); VersionTracker.GetExecutedScripts().Returns(new string[] {}); }
public IEnumerable <SqlScript> GetScripts(IConnectionManager connectionManager) { return(ScriptProvider.GetScripts(connectionManager).OrderBy(script => script.Name, Comparer)); }