DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Deveel.Data.SequenceManagerTests Class Reference
Inheritance diagram for Deveel.Data.SequenceManagerTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void CreateNormalSequence ()
 
void CreateNativeSequence ()
 
void IncremementSequenceValue ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

override IQuery CreateQuery (ISession session)
 
- Protected Member Functions inherited from Deveel.Data.ContextBasedTest
virtual void RegisterServices (ServiceContainer container)
 
virtual ISystem CreateSystem ()
 
virtual IDatabase CreateDatabase (ISystem system, IConfiguration configuration)
 
virtual ISession CreateAdminSession (IDatabase database)
 
ISession CreateUserSession (string userName, string password)
 
virtual void OnSetUp (string testName)
 
virtual void OnTearDown ()
 

Private Attributes

ObjectName testSequenceName = ObjectName.Parse("APP.test_sequence")
 

Additional Inherited Members

- Protected Attributes inherited from Deveel.Data.ContextBasedTest
const string AdminUserName = "SA"
 
const string AdminPassword = "1234567890"
 
const string DatabaseName = "testdb"
 
- Properties inherited from Deveel.Data.ContextBasedTest
virtual bool SingleContext [get]
 
IQuery Query [get, private set]
 
ISystem System [get, private set]
 
IDatabase Database [get, private set]
 
ISession Session [get, private set]
 

Detailed Description

Definition at line 27 of file SequenceManagerTests.cs.

Member Function Documentation

void Deveel.Data.SequenceManagerTests.CreateNativeSequence ( )
inline

Definition at line 54 of file SequenceManagerTests.cs.

54  {
55  var sequenceManager = new SequenceManager(Session.Transaction);
56 
57  var tableName = ObjectName.Parse("APP.test_table");
58  var seqInfo = SequenceInfo.Native(tableName);
59 
60  ISequence sequence = null;
61  Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo));
62  Assert.IsNotNull(sequence);
63  }
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
Definition: ObjectName.cs:139
Describes the name of an object within a database.
Definition: ObjectName.cs:44
ITransaction Transaction
Gets the instance of ITransaction that handles the transactional operations of this session...
Definition: ISession.cs:46
A default implementation of a sequence manager that is backed by a given transaction.
Provides the meta information about a ISequence configuring its operative behavior.
Definition: SequenceInfo.cs:28
static SequenceInfo Native(ObjectName tableName)
Creates an object that describes a native sequence for the table having the specified name...
Represents a numberic sequence in a transaction.
Definition: ISequence.cs:25
void Deveel.Data.SequenceManagerTests.CreateNormalSequence ( )
inline

Definition at line 42 of file SequenceManagerTests.cs.

42  {
43  var sequenceManager = new SequenceManager(Session.Transaction);
44 
45  var sequenceName = ObjectName.Parse("APP.test_sequence");
46  var seqInfo = new SequenceInfo(sequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);
47 
48  ISequence sequence =null;
49  Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo));
50  Assert.IsNotNull(sequence);
51  }
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
Definition: ObjectName.cs:139
Describes the name of an object within a database.
Definition: ObjectName.cs:44
ITransaction Transaction
Gets the instance of ITransaction that handles the transactional operations of this session...
Definition: ISession.cs:46
A default implementation of a sequence manager that is backed by a given transaction.
Provides the meta information about a ISequence configuring its operative behavior.
Definition: SequenceInfo.cs:28
Represents a numberic sequence in a transaction.
Definition: ISequence.cs:25
override IQuery Deveel.Data.SequenceManagerTests.CreateQuery ( ISession  session)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 30 of file SequenceManagerTests.cs.

30  {
31  var query = base.CreateQuery(session);
32 
33  if (TestContext.CurrentContext.Test.Name != "CreateNormalSequence") {
34  var seqInfo = new SequenceInfo(testSequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);
35  query.CreateObject(seqInfo);
36  }
37 
38  return query;
39  }
Provides the meta information about a ISequence configuring its operative behavior.
Definition: SequenceInfo.cs:28
void Deveel.Data.SequenceManagerTests.IncremementSequenceValue ( )
inline

Definition at line 66 of file SequenceManagerTests.cs.

66  {
67  var sequenceManager = new SequenceManager(Session.Transaction);
68 
69  ISequence sequence = null;
70  Assert.DoesNotThrow(() => sequence = sequenceManager.GetSequence(testSequenceName));
71  Assert.IsNotNull(sequence);
72 
73  SqlNumber currentValue = SqlNumber.Null;
74  Assert.DoesNotThrow(() => currentValue = sequence.NextValue());
75  Assert.IsNotNull(currentValue);
76  Assert.AreEqual(new SqlNumber(1), currentValue);
77  }
ITransaction Transaction
Gets the instance of ITransaction that handles the transactional operations of this session...
Definition: ISession.cs:46
A default implementation of a sequence manager that is backed by a given transaction.
static readonly SqlNumber Null
Definition: SqlNumber.cs:31
Represents a numberic sequence in a transaction.
Definition: ISequence.cs:25

Member Data Documentation

ObjectName Deveel.Data.SequenceManagerTests.testSequenceName = ObjectName.Parse("APP.test_sequence")
private

Definition at line 28 of file SequenceManagerTests.cs.


The documentation for this class was generated from the following file: