public void ColumnDataShouldBeCached() { var table = new Table("Users", null, TableType.Table); var realConnectionProvider = new Mysql40.Mysql40ConnectionProvider(); realConnectionProvider.SetConnectionString(ConnectionString); var proxiedConnectionProvider = A.Fake <IConnectionProvider>((o) => o.Wrapping(realConnectionProvider)); var schemaDataProvider = new MysqlScemaDataProvider40(proxiedConnectionProvider); Enumerable.ToList(schemaDataProvider.GetColumnsFor(table)); Enumerable.ToList(schemaDataProvider.GetColumnsFor(table)); Enumerable.ToList(schemaDataProvider.GetColumnsFor(table)); Enumerable.ToList(schemaDataProvider.GetColumnsFor(table)); A.CallTo(() => proxiedConnectionProvider.CreateConnection()).MustHaveHappened(Repeated.Exactly.Once); }
public void CanProvideAllColumnsFromTable() { var table = new Table("users", null, TableType.Table); var expectedColumns = new List <Column> { new Column("Id", table, true, DbType.Int32, 11), new Column("Name", table, false, DbType.String, 255), new Column("Password", table, false, DbType.String, 255), new Column("Age", table, false, DbType.Int32, 11) }; var connectionProvider = new Mysql40.Mysql40ConnectionProvider(); connectionProvider.SetConnectionString(ConnectionString); var schemaDataProvider = new MysqlScemaDataProvider40(connectionProvider); var columns = Enumerable.Select <MysqlColumnInfo, Column>(schemaDataProvider.GetColumnsFor(table), c => new Column(c.Name, table, c.IsAutoincrement, c.DbType, c.Capacity)); Assert.AreEqual(expectedColumns.Count, columns.Count()); columns.Should().Contain(expectedColumns); }