forked from github/KustoSchemaTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYamlDatabaseParserTests.cs
More file actions
38 lines (33 loc) · 1.41 KB
/
YamlDatabaseParserTests.cs
File metadata and controls
38 lines (33 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using KustoSchemaTools.Helpers;
using KustoSchemaTools.Parser;
using KustoSchemaTools.Plugins;
using KustoSchemaTools.Model;
namespace KustoSchemaTools.Tests.Parser
{
public class YamlDatabaseParserTests
{
const string BasePath = "DemoData";
const string Deployment = "DemoDeployment";
const string Database = "DemoDatabase";
[Fact]
public async Task GetDatabase()
{
var factory = new YamlDatabaseHandlerFactory<Model.Database>()
.WithPlugin(new TablePlugin())
.WithPlugin(new FunctionPlugin())
.WithPlugin(new MaterializedViewsPlugin())
.WithPlugin(new DatabaseCleanup());
var loader = factory.Create(Path.Combine(BasePath, Deployment), Database);
var db = await loader.LoadAsync();
Assert.NotNull(db);
Assert.Equal(2, db.Tables.Count);
Assert.Equal(1, db.Functions.Count);
Assert.Equal(6, db.Functions["UP"].Body.RowLength());
Assert.Equal("DemoDatabase", db.Name);
Assert.True(db.Tables["sourceTable"].RestrictedViewAccess);
// these tests do not compile! to be removed in a future PR.
// Assert.Equal("120d", db.Tables["tableWithUp"].RetentionAndCachePolicy.Retention);
// Assert.Equal("120d", db.Tables["sourceTable"].RetentionAndCachePolicy.HotCache);
}
}
}