DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
ContextQueryTests.cs
Go to the documentation of this file.
1 using System;
2 
3 using Deveel.Data.Mapping;
4 
5 using NUnit.Framework;
6 
7 namespace Deveel.Data.Linq {
8  [TestFixture]
10  [Test]
11  public void CreateContext() {
12  QueryContext context = null;
13  Assert.DoesNotThrow(() => context = new EmptyTestQueryContext(Query));
14  Assert.IsNotNull(context);
15  }
16 
17  [Test]
18  public void RequestTableNotConfigured() {
19  var context = new EmptyTestQueryContext(Query);
20  Assert.DoesNotThrow(() => context.Table<EmptyTestType>());
21  }
22 
23  [Test]
24  public void RequestEntryNotConfigured() {
25  var context = new EmptyTestQueryContext(Query);
26  Assert.Throws<QueryException>(() => context.Table<EmptyTestType>().FindById(1));
27  }
28 
29  class EmptyTestType {
30  }
31 
33  public EmptyTestQueryContext(IQuery context)
34  : base(context) {
35  }
36 
37  protected override void OnBuildMap(MappingContext mappingContext) {
38 
39  }
40  }
41  }
42 }
override void OnBuildMap(MappingContext mappingContext)