aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-11-27 20:35:08 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-11-27 20:35:08 +0200
commit7060dc80c707fc0441ff69fe4f899107cb3f6fc1 (patch)
treea72e2cf1be9fcce77e27446d93501bfc9b452265 /Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
parentd1038a08bdf51b1310be4ef00ebe9e21b0e12f81 (diff)
downloadTango-7060dc80c707fc0441ff69fe4f899107cb3f6fc1.tar.gz
Tango-7060dc80c707fc0441ff69fe4f899107cb3f6fc1.zip
Split DAL to DAl.Local & DAL.Remote due to ambiguity of table names in EF.
Implemented Unit testing for SQLite & SQL Server connections.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
new file mode 100644
index 000000000..b56f04c70
--- /dev/null
+++ b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
@@ -0,0 +1,64 @@
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Tango.DAL;
+using System.Linq;
+
+namespace Tango.UnitTesting
+{
+ [TestClass]
+ [TestCategory("DAL")]
+ public class DAL_TST
+ {
+ [TestMethod]
+ public void Validate_Server_SQLServer_Connection()
+ {
+ Guid guid = Guid.NewGuid();
+
+ using (var db = new DAL.Remote.DB.RemoteDB("LOCALHOST\\SQLEXPRESS", false))
+ {
+ var action = new DAL.Remote.DB.ACTION();
+ action.CODE = 1;
+ action.NAME = "Action 1";
+ action.DESCRIPTION = "Description 1";
+ action.GUID = guid;
+ action.LAST_UPDATED = DateTime.Now;
+
+ db.ACTIONS.Add(action);
+ db.SaveChanges();
+ }
+
+ using (var db = new DAL.Remote.DB.RemoteDB("LOCALHOST\\SQLEXPRESS", false))
+ {
+ var action = db.ACTIONS.Single(x => x.GUID == guid);
+ db.ACTIONS.Remove(action);
+ db.SaveChanges();
+ }
+ }
+
+ [TestMethod]
+ public void Validate_Local_SQLite_Connection()
+ {
+ String guid = Guid.NewGuid().ToString();
+
+ using (var db = new DAL.Local.DB.LocalDB(Helper.GetSQLiteFilePath()))
+ {
+ var action = new DAL.Local.DB.ACTION();
+ action.CODE = 1;
+ action.NAME = "Action 1";
+ action.DESCRIPTION = "Description 1";
+ action.GUID = guid;
+
+ db.ACTIONS.Add(action);
+ db.SaveChanges();
+ }
+
+ using (var db = new DAL.Local.DB.LocalDB(Helper.GetSQLiteFilePath()))
+ {
+ var actions = db.ACTIONS.ToList();
+ var action = db.ACTIONS.Single(x => x.GUID == guid);
+ db.ACTIONS.Remove(action);
+ db.SaveChanges();
+ }
+ }
+ }
+}