public void CheckDateTypeTest() { OracleTableDependency <DataTimeModel> tableDependency = null; try { tableDependency = new OracleTableDependency <DataTimeModel>(ConnectionString, TableName); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.Start(); Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(20000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(Truncate(timeStampColumn.Value, TimeSpan.FromSeconds(2)), Truncate(timeStampColumnReturned.Value, TimeSpan.FromSeconds(2))); Assert.AreEqual(dateColum.Date, dateColumReturned.Date); Assert.AreEqual(Truncate(timeStampWithTimeZone.DateTime, TimeSpan.FromMilliseconds(1)), Truncate(timeStampWithTimeZoneReturned.DateTime, TimeSpan.FromMilliseconds(1))); Assert.AreEqual(Truncate(timeStampWithLocalTimeZone.Value, TimeSpan.FromMilliseconds(1)), Truncate(timeStampWithLocalTimeZoneReturned.Value, TimeSpan.FromMilliseconds(1))); Assert.AreEqual(intervalDayToSecondColumn.Value, intervalDayToSecondColumnReturned.Value); Assert.AreEqual(intervalYearToMonthColumn.Value, intervalYearToMonthColumnReturned.Value); }
public void CheckTest2() { OracleTableDependency <Varchar2Model> tableDependency = null; try { var mapper = new ModelToTableMapper <Varchar2Model>(); mapper.AddMapping(c => c.Name, "COLUMN3"); tableDependency = new OracleTableDependency <Varchar2Model>(ConnectionString, TableName, mapper); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(ModifyTableContent2); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual("stringa ccia", _name); }
public void EventForAllColumnsTest() { OracleTableDependency <AAAItem2> tableDependency = null; string naming = null; try { tableDependency = new OracleTableDependency <AAAItem2>(ConnectionString, TableName); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(1000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 3); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Name, CheckValues[ChangeType.Insert.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Surname, CheckValues[ChangeType.Insert.ToString()].Item1.Surname); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Name, CheckValues[ChangeType.Update.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Surname, CheckValues[ChangeType.Update.ToString()].Item1.Surname); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Name, CheckValues[ChangeType.Delete.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Surname, CheckValues[ChangeType.Delete.ToString()].Item1.Surname); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void Test2() { OracleTableDependency <NullMessageContentTestOracleModel> tableDependency = null; string naming = null; try { var mapper = new ModelToTableMapper <NullMessageContentTestOracleModel>(); mapper.AddMapping(c => c.Description, "Long Description"); tableDependency = new OracleTableDependency <NullMessageContentTestOracleModel>(ConnectionString, TableName, mapper); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(1000); var t = new Task(ModifyTableContent2); t.Start(); t.Wait(5000); } finally { tableDependency?.Dispose(); } Assert.IsTrue(_id > 0); Assert.IsTrue(string.IsNullOrWhiteSpace(_name)); Assert.IsTrue(string.IsNullOrWhiteSpace(_description)); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void TaskCancellationTest() { string naming = null; OracleTableDependency <TaskCancellationTestOracleModel> tableDependency = null; try { var mapper = new ModelToTableMapper <TaskCancellationTestOracleModel>(); mapper.AddMapping(c => c.Name, "Long Description"); tableDependency = new OracleTableDependency <TaskCancellationTestOracleModel>(ConnectionString, TableName, mapper); tableDependency.OnChanged += (sender, e) => { }; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(500); } finally { tableDependency?.Dispose(); } var areAllDbObjectDisposed = OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming); Assert.IsTrue(areAllDbObjectDisposed == true); }
public void CheckTest() { OracleTableDependency <XmlAModel> tableDependency = null; try { var mapper = new ModelToTableMapper <XmlAModel>(); mapper.AddMapping(c => c.XmlColumn, "XMLCOLUMN"); tableDependency = new OracleTableDependency <XmlAModel>(ConnectionString, TableName, mapper); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } var expectedXml = new XmlDocument(); expectedXml.LoadXml(XML); var gotXml = new XmlDocument(); gotXml.LoadXml(_xml); Assert.AreEqual(gotXml.InnerXml, expectedXml.InnerXml); }
public void Test() { OracleTableDependency <DataAnnotationTestOracleModel> tableDependency = null; string naming = null; try { tableDependency = new OracleTableDependency <DataAnnotationTestOracleModel>(ConnectionString); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(30000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 3); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Name, CheckValues[ChangeType.Insert.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Description, CheckValues[ChangeType.Insert.ToString()].Item1.Description); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Name, CheckValues[ChangeType.Delete.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Description, CheckValues[ChangeType.Delete.ToString()].Item1.Description); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void CheckTypeTest() { OracleTableDependency <FloatAndIntegerTypesModel> tableDependency = null; try { tableDependency = new OracleTableDependency <FloatAndIntegerTypesModel>(ConnectionString, TableName); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.OnError += this.TableDependency_OnError; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(GotModel.FLOATCOLUMN, SetModel.FLOATCOLUMN); Assert.AreEqual(GotModel.FLOATCOLUMN, SetModel.FLOATCOLUMN); Assert.AreEqual(GotModel.NUMBERCOLUMN, SetModel.NUMBERCOLUMN); }
public void EventForSpecificColumnsTest() { OracleTableDependency <MultiDmlOperationsTesOracleModel> tableDependency = null; try { var mapper = new ModelToTableMapper <MultiDmlOperationsTesOracleModel>(); mapper.AddMapping(c => c.Name, "Long Description"); tableDependency = new OracleTableDependency <MultiDmlOperationsTesOracleModel>(ConnectionString, TableName, mapper); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(20000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 9); Assert.AreEqual(_deletedValue, "XXXXXX"); }
public void RaiseException1() { OracleTableDependency <TriggerTypeTestOracleModel> tableDependency = null; string naming = null; try { tableDependency = new OracleTableDependency <TriggerTypeTestOracleModel>( ConnectionString, TableName, null, new List <string>() { "NAME" }, DmlTriggerType.Insert, true); naming = tableDependency.DataBaseObjectsNamingConvention; } finally { tableDependency?.Dispose(); } Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void Test() { OracleTableDependency <Item5> tableDependency = null; string naming = null; var mapper = new ModelToTableMapper <Item5>(); mapper.AddMapping(c => c.Infos, "More Info"); var updateOf = new List <string>(); updateOf.Add("More Info"); try { tableDependency = new OracleTableDependency <Item5>(ConnectionString, TableName, mapper, updateOf); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(30000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 3); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Name, "Pizza MERGHERITA"); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Infos, "Pizza MERGHERITA"); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Name, "Pizza MERGHERITA"); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Infos, "FUNGHI PORCINI"); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Name, "Pizza"); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Infos, "FUNGHI PORCINI"); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void Test() { OracleTableDependency <EventForAllColumnsTestOracleModel> tableDependency = null; string naming = null; try { var mapper = new ModelToTableMapper <EventForAllColumnsTestOracleModel>(); mapper.AddMapping(c => c.Description, "Long Description"); tableDependency = new OracleTableDependency <EventForAllColumnsTestOracleModel>(ConnectionString, TableName, mapper); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(20000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 3); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Id, CheckValues[ChangeType.Insert.ToString()].Item1.Id); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Name, CheckValues[ChangeType.Insert.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Description, CheckValues[ChangeType.Insert.ToString()].Item1.Description); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Id, CheckValues[ChangeType.Update.ToString()].Item1.Id); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Name, CheckValues[ChangeType.Update.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Description, CheckValues[ChangeType.Update.ToString()].Item1.Description); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Id, CheckValues[ChangeType.Delete.ToString()].Item1.Id); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Name, CheckValues[ChangeType.Delete.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Description, CheckValues[ChangeType.Delete.ToString()].Item1.Description); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void All() { OracleTableDependency <TriggerTypeTestOracleModel> tableDependency = null; string naming = null; try { tableDependency = new OracleTableDependency <TriggerTypeTestOracleModel>( ConnectionString, TableName, null, (IList <string>)null, DmlTriggerType.All, true); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(1000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(5000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 3); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Name, "Pizza Mergherita"); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Surname, "Pizza Mergherita"); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Name, "Pizza Funghi"); Assert.AreEqual(CheckValues[ChangeType.Update.ToString()].Item2.Surname, "Pizza Mergherita"); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Name, "Pizza Funghi"); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Surname, "Pizza Mergherita"); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }
public void CheckTypeTest2() { OracleTableDependency <NVarchar2CharModel> tableDependency = null; try { tableDependency = new OracleTableDependency <NVarchar2CharModel>(ConnectionString, TableName); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.OnError += TableDependency_OnError; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(ModifyTableContent2); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_gotString, STRING_TEST_2); }
public void CheckTypeTest() { OracleTableDependency <RAWTypeModel> tableDependency = null; try { tableDependency = new OracleTableDependency <RAWTypeModel>(ConnectionString, TableName); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.OnError += TableDependency_OnError; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(GetString(SetModel.RAWCOLUMN), GetString(GotModel.RAWCOLUMN)); }
public void MergeTest() { OracleTableDependency <MargeTestOracleModel> tableDependency = null; try { tableDependency = new OracleTableDependency <MargeTestOracleModel>(ConnectionString, TarghetTableName); tableDependency.OnChanged += this.TableDependency_Changed; tableDependency.OnError += this.TableDependency_OnError; tableDependency.Start(); Thread.Sleep(1000); var t = new Task(MergeOperation); t.Start(); t.Wait(2000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(this._insertedValues.Quantity, 100); Assert.AreEqual(this._modifiedValues.Quantity, 200); }
public void Test() { OracleTableDependency <AAA_Item3> tableDependency = null; string naming = null; try { UpdateOfModel <AAA_Item3> updateOF = new UpdateOfModel <AAA_Item3>(); updateOF.Add(model => model.FamilyName); tableDependency = new OracleTableDependency <AAA_Item3>(ConnectionString, updateOF); tableDependency.OnChanged += TableDependency_Changed; tableDependency.Start(); naming = tableDependency.DataBaseObjectsNamingConvention; Thread.Sleep(5000); var t = new Task(ModifyTableContent); t.Start(); t.Wait(20000); } finally { tableDependency?.Dispose(); } Assert.AreEqual(_counter, 2); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.Name, CheckValues[ChangeType.Insert.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Insert.ToString()].Item2.FamilyName, CheckValues[ChangeType.Insert.ToString()].Item1.FamilyName); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.Name, CheckValues[ChangeType.Delete.ToString()].Item1.Name); Assert.AreEqual(CheckValues[ChangeType.Delete.ToString()].Item2.FamilyName, CheckValues[ChangeType.Delete.ToString()].Item1.FamilyName); Assert.IsTrue(OracleHelper.AreAllDbObjectsDisposed(ConnectionString, naming)); }