private string GetConnectionString(ISqlLocalDbApiAdapter instance, string pathToModel) { var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(_instance.ConnectionString); sqlConnectionStringBuilder.InitialCatalog = Path.GetFileNameWithoutExtension(pathToModel); sqlConnectionStringBuilder.IntegratedSecurity = true; sqlConnectionStringBuilder.AttachDBFilename = pathToModel; return(sqlConnectionStringBuilder.ToString()); }
public void SqlLocalDbApi_Is_ISqlLocalDbApiAdapter() { // Arrange using var instance = new SqlLocalDbApi(_loggerFactory); // Act ISqlLocalDbApiAdapter adapter = instance; // Assert adapter.LocalDb.ShouldBeSameAs(instance); }
public void TemporaryInstance_Is_ISqlLocalDbApiAdapter() { // Arrange var api = Mock.Of <ISqlLocalDbApi>(); using TemporarySqlLocalDbInstance instance = api.CreateTemporaryInstance(); // Act ISqlLocalDbApiAdapter adapter = instance; // Assert adapter.LocalDb.ShouldBeSameAs(api); }