示例#1
0
        public async Task Should_GetDatabasesAsync_ReturnsListOfAllDatabasesForAGivenConnectionString()
        {
            // ARRANGE
            var sut = new SqlDbSchemaReader();

            // ACT
            var actual = (await sut.GetDatabasesAsync(new ConnectionInfo(Connection))).ToList();


            // ASSERT
            actual.Should().NotBeNull().And.HaveCount(1);
            actual[0].Name.Should().Be("Sample_Database");
        }
示例#2
0
        public async Task Should_GetDatabaseTablesAsync_ReturnsListOfAllTablesForAGivenConnectionStringAndDatabase()
        {
            // ARRANGE
            var sut = new SqlDbSchemaReader();

            // ACT
            var actual = (await sut.GetDatabaseTablesAsync(new ConnectionInfo(Connection), "Sample_Database")).ToList();

            // ASSERT
            actual.Should().NotBeNull()
            .And.HaveCount(2)
            .And.Contain(m => m.TableName == "Table1" && m.SchemaName == "dbo" && m.Fields.Length == 4)
            .And.Contain(m => m.TableName == "Table2" && m.SchemaName == "dbo" && m.Fields.Length == 3);
        }