11 using NUnit.Framework;
13 namespace Deveel.Data.Linq {
18 using (var session = base.CreateAdminSession(database)) {
19 using (var query = session.CreateQuery()) {
20 CreateTestTable(query);
27 return base.CreateAdminSession(database);
40 context.CreateTable(tableInfo);
41 context.AddPrimaryKey(tableInfo.TableName,
"id",
"PK_PEOPLE_TABLE");
46 var row = table.NewRow();
49 row.SetDefault(0, context);
59 row.SetDefault(0, context);
69 row.SetDefault(0, context);
79 protected override void OnSetUp(
string testName) {
86 Assert.DoesNotThrow(() => entity =
Context.Table<
Person>().FindById(1));
87 Assert.IsNotNull(entity);
88 Assert.AreEqual(1, entity.
Id);
89 Assert.AreEqual(
"John", entity.
FirstName);
95 Assert.DoesNotThrow(() => entity =
Context.Table<
Person>().FirstOrDefault(x => x.Id == 1));
96 Assert.IsNotNull(entity);
97 Assert.AreEqual(1, entity.
Id);
98 Assert.AreEqual(
"John", entity.
FirstName);
107 mappingContext.Map<
Person>()
109 mappingContext.Map<
Person>()
110 .Member(person => person.Id)
113 mappingContext.Map<
Person>()
114 .Member(person => person.FirstName)
115 .HasName(
"first_name")
123 public int Id {
get; set; }
125 public string FirstName {
get; set; }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Date(DateTimeOffset value)
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
override void OnSetUp(string testName)
static BooleanType Boolean()
void AddTestData(IQuery context)
static NumericType Integer()
Describes the name of an object within a database.
override ISession CreateAdminSession(IDatabase database)
static DataObject String(string s)
static DataObject Boolean(SqlBoolean value)
The representation of a single database in the system.
void AddColumn(ColumnInfo column)
Adds a new column to the table at the last position of the columns list in the table metadata...
An isolated session to a given database for a given user, encapsulating the transaction for operation...
void CreateTestTable(IQuery context)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
static DateType DateTime()
static StringType String()
TestQueryContext(IQuery context)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
Defines the metadata properties of a table existing within a database.
override void OnBuildMap(MappingContext mappingContext)