public void RemoveDBFilesTest( ) { DBTest.CreateDB(); Assert.IsTrue(DBHelper.DatabaseExists(".", "MyPal")); DBHelper.RemoveDBFiles("."); Assert.IsTrue(!DBHelper.DatabaseExists(".", "MyPal")); }
public void SetUp() { try { DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal"); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); tblPeople.CreateColumn("Name", ColumnType.String, true); database.SaveStructure(); m_database = database.OpenDatabase( ); m_testTable = m_database.GetTable("People"); for (int i = 0; i < 10; i++) { IRecord record = m_testTable.NewRecord(); record.SetValue(Name, (500 - i).ToString()); record.Commit(); Assert.AreEqual((i + 1), m_testTable.Count); } } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SetUp() { try { DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal", DatabaseMode.Create); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); ColumnStructure colName = tblPeople.CreateColumn("Name", ColumnType.String, false); colName = colName; tblPeople.CreateColumn("Age", ColumnType.Integer, false); tblPeople.CreateColumn("Type", ColumnType.Integer, true); tblPeople.CreateColumn("DateTime", ColumnType.DateTime, true); tblPeople.SetCompoundIndex("Id", "Name"); tblPeople.SetCompoundIndex("Name", "Type"); database.SaveStructure(); database.Shutdown(); database = new DBStructure("", "MyPal"); database.LoadStructure( ); m_database = database.Database; } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SetUp() { try { Stream stream = File.Open("resume.txt", FileMode.OpenOrCreate, FileAccess.Write); BinaryWriter text = new BinaryWriter(stream); text.Write("Resume of developer"); text.Close(); stream.Close(); stream = File.Open("resumeTester.txt", FileMode.OpenOrCreate, FileAccess.Write); text = new BinaryWriter(stream); text.Write("Resume of tester"); text.Close(); stream.Close(); DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal"); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); tblPeople.CreateColumn("Name", ColumnType.String, true); tblPeople.CreateColumn("Resume", ColumnType.BLOB, false); database.SaveStructure(); m_database = database.OpenDatabase( ); m_testTable = m_database.GetTable("People"); } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void GetVersionEndBuild( ) { DBTest.CreateDB(); DBStructure database = new DBStructure("", "MyPal"); database.LoadVersionInfo(); Assert.AreEqual(true, database.Build != "undefined"); Assert.AreEqual(true, database.Version > 0); }
public void TearDown() { try { _database.Shutdown(); DBTest.RemoveDBFiles(); } catch (Exception exc) { Assert.Fail(exc.ToString()); } }
public void TearDown() { try { m_database.Shutdown(); DBTest.RemoveDBFiles(); } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SetUp() { try { DBTest.RemoveDBFiles(); DBTest.CreateDB(); DBStructure dbStruct = new DBStructure("", "MyPal"); dbStruct.LoadStructure(); m_database = dbStruct.OpenDatabase( ); } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SetUp() { DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal", DatabaseMode.Create); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); tblPeople.CreateColumn("Name", ColumnType.String, false); tblPeople.CreateColumn("Age", ColumnType.Integer, false); tblPeople.SetCompoundIndex("Name", "Age"); database.SaveStructure(); database.Shutdown(); database = new DBStructure("", "MyPal"); database.LoadStructure( ); m_database = database.Database; }
public void SetUp() { try { DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal", DatabaseMode.Create); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); ColumnStructure colName = tblPeople.CreateColumn("Name", ColumnType.String, false); colName = colName; tblPeople.CreateColumn("Age", ColumnType.Integer, false); tblPeople.CreateColumn("Type", ColumnType.Integer, true); tblPeople.CreateColumn("DateTime", ColumnType.DateTime, true); tblPeople.SetCompoundIndex("Id", "Name"); tblPeople.SetCompoundIndex("Name", "Type"); TableStructure tblTest = database.CreateTable("Test"); tblTest.CreateColumn("Id", ColumnType.Integer, false); tblTest.CreateColumn("Date", ColumnType.DateTime, false); tblTest.SetCompoundIndex("Id", "Date"); database.SaveStructure(); database.Shutdown(); database = new DBStructure("", "MyPal", DatabaseMode.Create); database.LoadStructure( ); _database = database.Database; _peopleTable = _database.GetTable("People"); _testTable = _database.GetTable("Test"); //m_testTable.InputMode = InputMode.Batch; for (int i = 0; i < 10; i++) { IRecord record = _peopleTable.NewRecord(); Assert.AreEqual(i, record.GetID(), "Id is wrong"); record.SetValue(1, (500 - i).ToString()); record.Commit(); Assert.AreEqual((i + 1), _peopleTable.Count, "Count is wrong"); } } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SmokeTestLoadDatabase( ) { DBTest.CreateDB(); DBStructure dbStruct = new DBStructure("", "MyPal"); dbStruct.LoadStructure(); IDatabase database = dbStruct.OpenDatabase( ); ITable people = database.GetTable("People"); IRecord record = people.NewRecord(); record.SetValue(Name, "zhu"); record.SetValue(Age, 30); ITable books = database.GetTable("Books"); record = books.NewRecord(); record.SetValue(Name, "Algorithm"); record.SetValue(Price, 1000); database.Shutdown(); }
public void TearDown() { try { m_database.Shutdown(); DBTest.RemoveDBFiles(); File.Delete("resume.txt"); File.Delete("resumeTester.txt"); string[] files = System.IO.Directory.GetFiles(".", "*.blob"); foreach (string fileName in files) { System.IO.File.Delete(fileName); } } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SetUp() { try { DBTest.RemoveDBFiles(); DBStructure database = new DBStructure("", "MyPal"); TableStructure tblPeople = database.CreateTable("People"); tblPeople.CreateColumn("Id", ColumnType.Integer, true); tblPeople.CreateColumn("Name", ColumnType.String, true); tblPeople.CreateColumn("Cash", ColumnType.Double, true); database.SaveStructure(); m_database = database.OpenDatabase( ); m_testTable = m_database.GetTable("People"); } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void SmokeTestSaveLoadDBStructure( ) { DBTest.CreateDB(); }
public void SetUp() { DBTest.RemoveDBFiles(); }
public void TearDown() { m_database.Shutdown(); DBTest.RemoveDBFiles(); }
public void TearDown() { DBTest.RemoveDBFiles(); }