コード例 #1
0
        public void SaveIEnumerableExtension()
        {
            List <Task2> Tasks = new List <Task2>();

            for (int x = 0; x < 100; ++x)
            {
                Task2 TempTask = new Task2();
                TempTask.Description = "This is a test";
                TempTask.DueDate     = new DateTime(1900, 1, 1);
                TempTask.Name        = "Test task";
                Tasks.Add(TempTask);
            }
            Tasks.Save <Task2, long>();

            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task2_", CommandType.Text, "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                int Counter = 0;
                while (Helper.Read())
                {
                    Assert.Equal("This is a test", Helper.GetParameter <string>("Description_", ""));
                    Assert.Equal("Test task", Helper.GetParameter <string>("Name_", ""));
                    ++Counter;
                }
                Assert.Equal(100, Counter);
            }
        }
コード例 #2
0
        public void CommandInsertNullString()
        {
            Guid TempGuid = Guid.NewGuid();

            Utilities.SQL.MicroORM.Command TempCommand = new Utilities.SQL.MicroORM.Command("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@0,@1,@2,@3,@4,@5,@6,@7)", CommandType.Text, "@", "Test String", null, 12345, true, 1234.5678m, 12345.6534f, new DateTime(1999, 12, 31), TempGuid);
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper(TempCommand, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue1", ""));
                    Assert.Equal("This is a null string", Helper.GetParameter <string>("StringValue2", "This is a null string"));
                    Assert.Equal(12345, Helper.GetParameter <long>("BigIntValue", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BitValue", false));
                    Assert.Equal(1234.5678m, Helper.GetParameter <decimal>("DecimalValue", 0));
                    Assert.Equal(12345.6534f, Helper.GetParameter <float>("FloatValue", 0));
                    Assert.Equal(TempGuid, Helper.GetParameter <Guid>("GUIDValue", Guid.Empty));
                    Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter <DateTime>("DateTimeValue", DateTime.Now));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
        }
コード例 #3
0
        public void Delete()
        {
            Guid TempGuid = Guid.NewGuid();

            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.AddParameter <string>("@StringValue1", "Test String");
                Helper.AddParameter <string>("@StringValue2", "Test String");
                Helper.AddParameter <long>("@BigIntValue", 12345);
                Helper.AddParameter <bool>("@BitValue", true);
                Helper.AddParameter <decimal>("@DecimalValue", 1234.5678m);
                Helper.AddParameter <float>("@FloatValue", 12345.6534f);
                Helper.AddParameter <Guid>("@GUIDValue", TempGuid);
                Helper.AddParameter <DateTime>("@DateTimeValue", new DateTime(1999, 12, 31));
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("delete from TestTable where @ID=ID", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.AddParameter <int>("@ID", 1);
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.False(true, "Nothing was deleted");
                }
            }
        }
コード例 #4
0
ファイル: Mapping.cs プロジェクト: ewin66/VilinCode
        public void Delete()
        {
            using (Utilities.SQL.SQLHelper Helper2 = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Mapping <ObjectClass1> TestObject = Utilities.SQL.SQLHelper.Map <ObjectClass1>("TestTable", "ID_", true, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
                TestObject.Map(x => x.ID, "ID_")
                .Map(x => x.StringValue, "StringValue_")
                .Map(x => x.FloatValue, "FloatValue_")
                .Map(x => x.BoolValue, "BoolValue_")
                .Map(x => x.LongValue, "LongValue_")
                .Map(x => x.StringMaxValue, "StringMaxValue_");
                Utilities.Random.Random Rand       = new Utilities.Random.Random();
                ObjectClass1            TempObject = new ObjectClass1();
                TempObject.StringValue    = "Test";
                TempObject.BoolValue      = false;
                TempObject.FloatValue     = 1.5f;
                TempObject.LongValue      = 12;
                TempObject.StringMaxValue = Rand.Next <string>(new RegexStringGenerator(6000));
                Helper2.Save <ObjectClass1, int>(TempObject);
                Assert.Equal(1, Helper2.Delete <ObjectClass1>(TempObject));

                using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT COUNT(*) AS ItemCount FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
                {
                    Helper.ExecuteReader();
                    if (Helper.Read())
                    {
                        Assert.Equal(0, Helper.GetParameter <int>("ItemCount", -1));
                    }
                    else
                    {
                        Assert.False(true, "Nothing was inserted");
                    }
                }
            }
        }
コード例 #5
0
        public void Save()
        {
            Task TempTask = new Task();

            TempTask.Description = "This is a test";
            TempTask.DueDate     = new DateTime(1900, 1, 1);
            TempTask.Name        = "Test task";

            List <Task> Tasks   = new List <Task>();
            Task        SubTask = new Task();

            SubTask.Description = "This is a test";
            SubTask.DueDate     = new DateTime(1900, 1, 1);
            SubTask.Name        = "Sub task 1";
            Tasks.Add(SubTask);
            SubTask             = new Task();
            SubTask.Description = "This is a test";
            SubTask.DueDate     = new DateTime(1900, 1, 1);
            SubTask.Name        = "Sub task 2";
            Tasks.Add(SubTask);
            SubTask             = new Task();
            SubTask.Description = "This is a test";
            SubTask.DueDate     = new DateTime(1900, 1, 1);
            SubTask.Name        = "Sub task 3";
            Tasks.Add(SubTask);

            TempTask.SubTasks = Tasks;
            Project TestProject = new Project();

            TestProject.Description = "This is a test project";
            TestProject.Name        = "Test Project";
            List <Task> Tasks2 = new List <Task>();

            Tasks2.Add(TempTask);
            TestProject.Tasks = Tasks2;
            TestProject.Save();
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Project_", "Data Source=localhost;Initial Catalog=ORMTestDatabase2;Integrated Security=SSPI;Pooling=false", CommandType.Text))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal("This is a test project", Helper.GetParameter <string>("Description_", ""));
                    Assert.Equal("Test Project", Helper.GetParameter <string>("Name_", ""));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task_", "Data Source=localhost;Initial Catalog=ORMTestDatabase2;Integrated Security=SSPI;Pooling=false", CommandType.Text))
            {
                Helper.ExecuteReader();
                while (Helper.Read())
                {
                    Assert.Equal("This is a test", Helper.GetParameter <string>("Description_", ""));
                    Assert.Contains(Helper.GetParameter <string>("Name_", ""), new string[] { "Sub task 1", "Sub task 2", "Sub task 3", "Test task" });
                }
            }
        }
コード例 #6
0
        public void CachedQuery()
        {
            Utilities.SQL.SQLHelper.ClearCache();
            Guid TempGuid = Guid.NewGuid();

            for (int x = 0; x < 100; ++x)
            {
                using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
                {
                    Assert.Equal(1, Helper.AddParameter <string>("@StringValue1", "Test String")
                                 .AddParameter <string>("@StringValue2", "Test String")
                                 .AddParameter <long>("@BigIntValue", 12345)
                                 .AddParameter <bool>("@BitValue", true)
                                 .AddParameter <decimal>("@DecimalValue", 1234.5678m)
                                 .AddParameter <float>("@FloatValue", 12345.6534f)
                                 .AddParameter <Guid>("@GUIDValue", TempGuid)
                                 .AddParameter <DateTime>("@DateTimeValue", new DateTime(1999, 12, 31))
                                 .ExecuteNonQuery());
                }
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader(Cache: true);
                int Count = 0;
                while (Helper.Read())
                {
                    ++Count;
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue1", ""));
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue2", ""));
                    Assert.Equal(12345, Helper.GetParameter <long>("BigIntValue", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BitValue", false));
                    Assert.Equal(1234.5678m, Helper.GetParameter <decimal>("DecimalValue", 0));
                    Assert.Equal(12345.6534f, Helper.GetParameter <float>("FloatValue", 0));
                    Assert.Equal(TempGuid, Helper.GetParameter <Guid>("GUIDValue", TempGuid));
                    Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter <DateTime>("DateTimeValue", DateTime.Now));
                }
                Assert.Equal(100, Count);
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader(Cache: true);
                int Count = 0;
                while (Helper.Read())
                {
                    ++Count;
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue1", ""));
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue2", ""));
                    Assert.Equal(12345, Helper.GetParameter <long>("BigIntValue", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BitValue", false));
                    Assert.Equal(1234.5678m, Helper.GetParameter <decimal>("DecimalValue", 0));
                    Assert.Equal(12345.6534f, Helper.GetParameter <float>("FloatValue", 0));
                    Assert.Equal(TempGuid, Helper.GetParameter <Guid>("GUIDValue", TempGuid));
                    Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter <DateTime>("DateTimeValue", DateTime.Now));
                }
                Assert.Equal(100, Count);
            }
        }
コード例 #7
0
        public void BulkCopy()
        {
            Guid TempGuid = Guid.NewGuid();
            List <BulkCopyObject> Objects = new List <BulkCopyObject>();

            for (int x = 0; x < 100; ++x)
            {
                BulkCopyObject TempObject = new BulkCopyObject();
                TempObject.BigIntValue   = 12345;
                TempObject.BitValue      = true;
                TempObject.DateTimeValue = new DateTime(1999, 12, 31);
                TempObject.DecimalValue  = 1234.5678m;
                TempObject.FloatValue    = 12345.6534f;
                TempObject.GUIDValue     = TempGuid;
                TempObject.ID            = x + 1;
                TempObject.StringValue1  = "Test String";
                TempObject.StringValue2  = "Test String";
                Objects.Add(TempObject);
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteBulkCopy(Objects.ToDataTable(), "TestTable");
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                bool Inserted = false;
                while (Helper.Read())
                {
                    Inserted = true;
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue1", ""));
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue2", ""));
                    Assert.Equal(12345, Helper.GetParameter <long>("BigIntValue", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BitValue", false));
                    Assert.Equal(1234.5678m, Helper.GetParameter <decimal>("DecimalValue", 0));
                    Assert.Equal(12345.6534f, Helper.GetParameter <float>("FloatValue", 0));
                    Assert.Equal(TempGuid, Helper.GetParameter <Guid>("GUIDValue", Guid.Empty));
                    Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter <DateTime>("DateTimeValue", DateTime.Now));
                }
                if (!Inserted)
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT COUNT(*) as [ItemCount] FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal(100, Helper.GetParameter <int>("ItemCount", 0));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
        }
コード例 #8
0
 public void BulkCopy()
 {
     Guid TempGuid = Guid.NewGuid();
     List<BulkCopyObject> Objects = new List<BulkCopyObject>();
     for (int x = 0; x < 100; ++x)
     {
         BulkCopyObject TempObject = new BulkCopyObject();
         TempObject.BigIntValue = 12345;
         TempObject.BitValue = true;
         TempObject.DateTimeValue = new DateTime(1999, 12, 31);
         TempObject.DecimalValue = 1234.5678m;
         TempObject.FloatValue = 12345.6534f;
         TempObject.GUIDValue = TempGuid;
         TempObject.ID = x + 1;
         TempObject.StringValue1 = "Test String";
         TempObject.StringValue2 = "Test String";
         Objects.Add(TempObject);
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteBulkCopy(Objects.ToDataTable(), "TestTable");
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         bool Inserted = false;
         while (Helper.Read())
         {
             Inserted = true;
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue1", ""));
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue2", ""));
             Assert.Equal(12345, Helper.GetParameter<long>("BigIntValue", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BitValue", false));
             Assert.Equal(1234.5678m, Helper.GetParameter<decimal>("DecimalValue", 0));
             Assert.Equal(12345.6534f, Helper.GetParameter<float>("FloatValue", 0));
             Assert.Equal(TempGuid, Helper.GetParameter<Guid>("GUIDValue", Guid.Empty));
             Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter<DateTime>("DateTimeValue", DateTime.Now));
         }
         if (!Inserted)
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT COUNT(*) as [ItemCount] FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         if (Helper.Read())
         {
             Assert.Equal(100, Helper.GetParameter<int>("ItemCount", 0));
         }
         else
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
 }
コード例 #9
0
        public void Update()
        {
            Guid TempGuid = Guid.NewGuid();

            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.AddParameter <string>("@StringValue1", "Test");
                Helper.AddParameter <string>("@StringValue2", "Test");
                Helper.AddParameter <long>("@BigIntValue", 123);
                Helper.AddParameter <bool>("@BitValue", false);
                Helper.AddParameter <decimal>("@DecimalValue", 1234);
                Helper.AddParameter <float>("@FloatValue", 12345);
                Helper.AddParameter <Guid>("@GUIDValue", Guid.NewGuid());
                Helper.AddParameter <DateTime>("@DateTimeValue", new DateTime(1999, 1, 1));
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("update TestTable set StringValue1=@StringValue1,StringValue2=@StringValue2,BigIntValue=@BigIntValue,BitValue=@BitValue,DecimalValue=@DecimalValue,FloatValue=@FloatValue,DateTimeValue=@DateTimeValue,GUIDValue=@GUIDValue", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.AddParameter <string>("@StringValue1", "Test String");
                Helper.AddParameter <string>("@StringValue2", "Test String");
                Helper.AddParameter <long>("@BigIntValue", 12345);
                Helper.AddParameter <bool>("@BitValue", true);
                Helper.AddParameter <decimal>("@DecimalValue", 1234.5678m);
                Helper.AddParameter <float>("@FloatValue", 12345.6534f);
                Helper.AddParameter <Guid>("@GUIDValue", TempGuid);
                Helper.AddParameter <DateTime>("@DateTimeValue", new DateTime(1999, 12, 31));
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue1", ""));
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue2", ""));
                    Assert.Equal(12345, Helper.GetParameter <long>("BigIntValue", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BitValue", false));
                    Assert.Equal(1234.5678m, Helper.GetParameter <decimal>("DecimalValue", 0));
                    Assert.Equal(12345.6534f, Helper.GetParameter <float>("FloatValue", 0));
                    Assert.Equal(TempGuid, Helper.GetParameter <Guid>("GUIDValue", Guid.Empty));
                    Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter <DateTime>("DateTimeValue", DateTime.Now));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
        }
コード例 #10
0
ファイル: Mapping.cs プロジェクト: ewin66/VilinCode
 public void Update()
 {
     using (Utilities.SQL.SQLHelper Helper2 = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Mapping <ObjectClass1> TestObject = Utilities.SQL.SQLHelper.Map <ObjectClass1>("TestTable", "ID_", true, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
         TestObject.Map(x => x.ID, "ID_")
         .Map(x => x.StringValue, "StringValue_")
         .Map(x => x.FloatValue, "FloatValue_")
         .Map(x => x.BoolValue, "BoolValue_")
         .Map(x => x.LongValue, "LongValue_")
         .Map(x => x.StringMaxValue, "StringMaxValue_");
         Utilities.Random.Random Rand       = new Utilities.Random.Random(12346);
         ObjectClass1            TempObject = new ObjectClass1();
         TempObject.StringValue    = "Test";
         TempObject.BoolValue      = false;
         TempObject.FloatValue     = 1.5f;
         TempObject.LongValue      = 12;
         TempObject.StringMaxValue = Rand.Next <string>(new RegexStringGenerator(6000));
         TempObject.ID             = Helper2.Insert <ObjectClass1, int>(TempObject);
         Rand = new Utilities.Random.Random(12345);
         TempObject.StringValue    = "Test String";
         TempObject.BoolValue      = true;
         TempObject.FloatValue     = 1234.5f;
         TempObject.LongValue      = 12345;
         TempObject.StringMaxValue = Rand.Next <string>(new RegexStringGenerator(6000));
         Helper2.Update(TempObject);
         using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
         {
             Helper.ExecuteReader();
             if (Helper.Read())
             {
                 Assert.Equal("Test String", Helper.GetParameter <string>("StringValue_", ""));
                 Assert.Equal(1234.5f, Helper.GetParameter <float>("FloatValue_", 0));
                 Assert.Equal(true, Helper.GetParameter <bool>("BoolValue_", false));
                 Assert.Equal(12345, Helper.GetParameter <long>("LongValue_", 0));
                 Assert.Equal(TempObject.ID, Helper.GetParameter <int>("ID_", 0));
                 Assert.Equal(TempObject.StringMaxValue, Helper.GetParameter <string>("StringMaxValue_", ""));
             }
             else
             {
                 Assert.False(true, "Nothing was inserted");
             }
         }
     }
 }
コード例 #11
0
        public void Save()
        {
            Utilities.SQL.SQLHelper.Database("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
            Utilities.SQL.SQLHelper.Map <ObjectClass1>("TestTable", "ID_", Database: "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false")
            .Map(x => x.ID, "ID_")
            .Map(x => x.StringValue, "StringValue_")
            .Map(x => x.FloatValue, "FloatValue_")
            .Map(x => x.BoolValue, "BoolValue_")
            .Map(x => x.LongValue, "LongValue_");
            ObjectClass1 TempObject = new ObjectClass1();

            using (Utilities.SQL.SQLHelper ORM = new Utilities.SQL.SQLHelper("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                TempObject.StringValue = "Test";
                TempObject.BoolValue   = false;
                TempObject.FloatValue  = 1.5f;
                TempObject.LongValue   = 12;
                ORM.Save <ObjectClass1, int>(TempObject);
                TempObject.StringValue = "Test String";
                TempObject.BoolValue   = true;
                TempObject.FloatValue  = 1234.5f;
                TempObject.LongValue   = 12345;
                ORM.Save <ObjectClass1, int>(TempObject);
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal("Test String", Helper.GetParameter <string>("StringValue_", ""));
                    Assert.Equal(1234.5f, Helper.GetParameter <float>("FloatValue_", 0));
                    Assert.Equal(true, Helper.GetParameter <bool>("BoolValue_", false));
                    Assert.Equal(12345, Helper.GetParameter <long>("LongValue_", 0));
                    Assert.Equal(TempObject.ID, Helper.GetParameter <int>("ID_", 0));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
        }
コード例 #12
0
        public void Delete()
        {
            using (Utilities.SQL.SQLHelper Helper2 = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
            {
                Mapping<ObjectClass1> TestObject = Utilities.SQL.SQLHelper.Map<ObjectClass1>("TestTable", "ID_", true, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
                TestObject.Map(x => x.ID, "ID_")
                    .Map(x => x.StringValue, "StringValue_")
                    .Map(x => x.FloatValue, "FloatValue_")
                    .Map(x => x.BoolValue, "BoolValue_")
                    .Map(x => x.LongValue, "LongValue_")
                    .Map(x => x.StringMaxValue, "StringMaxValue_");
                Utilities.Random.Random Rand = new Utilities.Random.Random();
                ObjectClass1 TempObject = new ObjectClass1();
                TempObject.StringValue = "Test";
                TempObject.BoolValue = false;
                TempObject.FloatValue = 1.5f;
                TempObject.LongValue = 12;
                TempObject.StringMaxValue = Rand.Next<string>(new RegexStringGenerator(6000));
                Helper2.Save<ObjectClass1, int>(TempObject);
                Assert.Equal(1, Helper2.Delete<ObjectClass1>(TempObject));

                using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT COUNT(*) AS ItemCount FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
                {
                    Helper.ExecuteReader();
                    if (Helper.Read())
                    {
                        Assert.Equal(0, Helper.GetParameter<int>("ItemCount", -1));
                    }
                    else
                    {
                        Assert.False(true, "Nothing was inserted");
                    }
                }
            }
        }
コード例 #13
0
 public void CachedQuery()
 {
     Utilities.SQL.SQLHelper.ClearCache();
     Guid TempGuid = Guid.NewGuid();
     for (int x = 0; x < 100; ++x)
     {
         using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
         {
             Assert.Equal(1, Helper.AddParameter<string>("@StringValue1", "Test String")
                 .AddParameter<string>("@StringValue2", "Test String")
                 .AddParameter<long>("@BigIntValue", 12345)
                 .AddParameter<bool>("@BitValue", true)
                 .AddParameter<decimal>("@DecimalValue", 1234.5678m)
                 .AddParameter<float>("@FloatValue", 12345.6534f)
                 .AddParameter<Guid>("@GUIDValue", TempGuid)
                 .AddParameter<DateTime>("@DateTimeValue", new DateTime(1999, 12, 31))
                 .ExecuteNonQuery());
         }
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader(Cache: true);
         int Count = 0;
         while (Helper.Read())
         {
             ++Count;
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue1", ""));
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue2", ""));
             Assert.Equal(12345, Helper.GetParameter<long>("BigIntValue", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BitValue", false));
             Assert.Equal(1234.5678m, Helper.GetParameter<decimal>("DecimalValue", 0));
             Assert.Equal(12345.6534f, Helper.GetParameter<float>("FloatValue", 0));
             Assert.Equal(TempGuid, Helper.GetParameter<Guid>("GUIDValue", TempGuid));
             Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter<DateTime>("DateTimeValue", DateTime.Now));
         }
         Assert.Equal(100, Count);
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader(Cache: true);
         int Count = 0;
         while (Helper.Read())
         {
             ++Count;
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue1", ""));
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue2", ""));
             Assert.Equal(12345, Helper.GetParameter<long>("BigIntValue", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BitValue", false));
             Assert.Equal(1234.5678m, Helper.GetParameter<decimal>("DecimalValue", 0));
             Assert.Equal(12345.6534f, Helper.GetParameter<float>("FloatValue", 0));
             Assert.Equal(TempGuid, Helper.GetParameter<Guid>("GUIDValue", TempGuid));
             Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter<DateTime>("DateTimeValue", DateTime.Now));
         }
         Assert.Equal(100, Count);
     }
 }
コード例 #14
0
        public void SaveIEnumerableExtension()
        {
            List<Task2> Tasks = new List<Task2>();
            for (int x = 0; x < 100; ++x)
            {
                Task2 TempTask = new Task2();
                TempTask.Description = "This is a test";
                TempTask.DueDate = new DateTime(1900, 1, 1);
                TempTask.Name = "Test task";
                Tasks.Add(TempTask);
            }
            Tasks.Save<Task2, long>();

            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task2_", "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false", CommandType.Text))
            {
                Helper.ExecuteReader();
                int Counter = 0;
                while (Helper.Read())
                {
                    Assert.Equal("This is a test", Helper.GetParameter<string>("Description_", ""));
                    Assert.Equal("Test task", Helper.GetParameter<string>("Name_", ""));
                    ++Counter;
                }
                Assert.Equal(100, Counter);
            }
        }
コード例 #15
0
 public void Update()
 {
     using (Utilities.SQL.SQLHelper Helper2 = new Utilities.SQL.SQLHelper("", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Mapping<ObjectClass1> TestObject = Utilities.SQL.SQLHelper.Map<ObjectClass1>("TestTable", "ID_", true, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_")
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_")
             .Map(x => x.StringMaxValue, "StringMaxValue_");
         Utilities.Random.Random Rand = new Utilities.Random.Random(12346);
         ObjectClass1 TempObject = new ObjectClass1();
         TempObject.StringValue = "Test";
         TempObject.BoolValue = false;
         TempObject.FloatValue = 1.5f;
         TempObject.LongValue = 12;
         TempObject.StringMaxValue = Rand.Next<string>(new RegexStringGenerator(6000));
         TempObject.ID = Helper2.Insert<ObjectClass1, int>(TempObject);
         Rand = new Utilities.Random.Random(12345);
         TempObject.StringValue = "Test String";
         TempObject.BoolValue = true;
         TempObject.FloatValue = 1234.5f;
         TempObject.LongValue = 12345;
         TempObject.StringMaxValue = Rand.Next<string>(new RegexStringGenerator(6000));
         Helper2.Update(TempObject);
         using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
         {
             Helper.ExecuteReader();
             if (Helper.Read())
             {
                 Assert.Equal("Test String", Helper.GetParameter<string>("StringValue_", ""));
                 Assert.Equal(1234.5f, Helper.GetParameter<float>("FloatValue_", 0));
                 Assert.Equal(true, Helper.GetParameter<bool>("BoolValue_", false));
                 Assert.Equal(12345, Helper.GetParameter<long>("LongValue_", 0));
                 Assert.Equal(TempObject.ID, Helper.GetParameter<int>("ID_", 0));
                 Assert.Equal(TempObject.StringMaxValue, Helper.GetParameter<string>("StringMaxValue_", ""));
             }
             else
             {
                 Assert.False(true, "Nothing was inserted");
             }
         }
     }
 }
コード例 #16
0
        public void Update()
        {
            Task3 TempTask = new Task3();
            TempTask.Description = "This is a test";
            TempTask.DueDate = new DateTime(1900, 1, 1);
            TempTask.Name = "Test task";

            List<Task3> Tasks = new List<Task3>();
            Task3 SubTask = new Task3();
            SubTask.Description = "This is a test";
            SubTask.DueDate = new DateTime(1900, 1, 1);
            SubTask.Name = "Sub task 1";
            Tasks.Add(SubTask);
            SubTask = new Task3();
            SubTask.Description = "This is a test";
            SubTask.DueDate = new DateTime(1900, 1, 1);
            SubTask.Name = "Sub task 3";
            Tasks.Add(SubTask);
            SubTask = new Task3();
            SubTask.Description = "This is a test";
            SubTask.DueDate = new DateTime(1900, 1, 1);
            SubTask.Name = "Sub task 3";
            Tasks.Add(SubTask);

            TempTask.SubTasks = Tasks;
            Project3 TestProject = new Project3();
            TestProject.ID = "A";
            TestProject.Name = "Test Project";
            List<Task3> Tasks3 = new List<Task3>();
            Tasks3.Add(TempTask);
            TestProject.Tasks = Tasks3;
            TestProject.Save();
            TestProject.Name = "Test description3";
            TestProject.Save();
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Project3_", CommandType.Text, "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                if (Helper.Read())
                {
                    Assert.Equal("", Helper.GetParameter<string>("Description_", ""));
                    Assert.Equal("Test description3", Helper.GetParameter<string>("Name_", ""));
                }
                else
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM Task3_", CommandType.Text, "Data Source=localhost;Initial Catalog=ORMTestDatabase3;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.ExecuteReader();
                while (Helper.Read())
                {
                    Assert.Equal("This is a test", Helper.GetParameter<string>("Description_", ""));
                    Assert.Contains(Helper.GetParameter<string>("Name_", ""), new string[] { "Sub task 1", "Sub task 3", "Sub task 3", "Test task" });
                }
            }
        }
コード例 #17
0
 public void Update()
 {
     Guid TempGuid = Guid.NewGuid();
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.AddParameter<string>("@StringValue1", "Test");
         Helper.AddParameter<string>("@StringValue2", "Test");
         Helper.AddParameter<long>("@BigIntValue", 123);
         Helper.AddParameter<bool>("@BitValue", false);
         Helper.AddParameter<decimal>("@DecimalValue", 1234);
         Helper.AddParameter<float>("@FloatValue", 12345);
         Helper.AddParameter<Guid>("@GUIDValue", Guid.NewGuid());
         Helper.AddParameter<DateTime>("@DateTimeValue", new DateTime(1999, 1, 1));
         Helper.ExecuteNonQuery();
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("update TestTable set StringValue1=@StringValue1,StringValue2=@StringValue2,BigIntValue=@BigIntValue,BitValue=@BitValue,DecimalValue=@DecimalValue,FloatValue=@FloatValue,DateTimeValue=@DateTimeValue,GUIDValue=@GUIDValue", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.AddParameter<string>("@StringValue1", "Test String");
         Helper.AddParameter<string>("@StringValue2", "Test String");
         Helper.AddParameter<long>("@BigIntValue", 12345);
         Helper.AddParameter<bool>("@BitValue", true);
         Helper.AddParameter<decimal>("@DecimalValue", 1234.5678m);
         Helper.AddParameter<float>("@FloatValue", 12345.6534f);
         Helper.AddParameter<Guid>("@GUIDValue", TempGuid);
         Helper.AddParameter<DateTime>("@DateTimeValue", new DateTime(1999, 12, 31));
         Helper.ExecuteNonQuery();
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         if (Helper.Read())
         {
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue1", ""));
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue2", ""));
             Assert.Equal(12345, Helper.GetParameter<long>("BigIntValue", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BitValue", false));
             Assert.Equal(1234.5678m, Helper.GetParameter<decimal>("DecimalValue", 0));
             Assert.Equal(12345.6534f, Helper.GetParameter<float>("FloatValue", 0));
             Assert.Equal(TempGuid, Helper.GetParameter<Guid>("GUIDValue", Guid.Empty));
             Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter<DateTime>("DateTimeValue", DateTime.Now));
         }
         else
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
 }
コード例 #18
0
 public void Update()
 {
     Utilities.SQL.SQLHelper.Database("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
     Utilities.SQL.SQLHelper.Map<ObjectClass1>("TestTable", "ID_", Database: "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false")
             .Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_")
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_");
     ObjectClass1 TempObject = new ObjectClass1();
     using (Utilities.SQL.SQLHelper ORM = new Utilities.SQL.SQLHelper("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         TempObject.StringValue = "Test";
         TempObject.BoolValue = false;
         TempObject.FloatValue = 1.5f;
         TempObject.LongValue = 12;
         TempObject.ID = ORM.Insert<ObjectClass1, int>(TempObject);
         TempObject.StringValue = "Test String";
         TempObject.BoolValue = true;
         TempObject.FloatValue = 1234.5f;
         TempObject.LongValue = 12345;
         ORM.Update<ObjectClass1>(TempObject);
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         if (Helper.Read())
         {
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue_", ""));
             Assert.Equal(1234.5f, Helper.GetParameter<float>("FloatValue_", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BoolValue_", false));
             Assert.Equal(12345, Helper.GetParameter<long>("LongValue_", 0));
             Assert.Equal(TempObject.ID, Helper.GetParameter<int>("ID_", 0));
         }
         else
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
 }
コード例 #19
0
 public void Delete()
 {
     Guid TempGuid = Guid.NewGuid();
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@StringValue1,@StringValue2,@BigIntValue,@BitValue,@DecimalValue,@FloatValue,@DateTimeValue,@GUIDValue)", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.AddParameter<string>("@StringValue1", "Test String");
         Helper.AddParameter<string>("@StringValue2", "Test String");
         Helper.AddParameter<long>("@BigIntValue", 12345);
         Helper.AddParameter<bool>("@BitValue", true);
         Helper.AddParameter<decimal>("@DecimalValue", 1234.5678m);
         Helper.AddParameter<float>("@FloatValue", 12345.6534f);
         Helper.AddParameter<Guid>("@GUIDValue", TempGuid);
         Helper.AddParameter<DateTime>("@DateTimeValue", new DateTime(1999, 12, 31));
         Helper.ExecuteNonQuery();
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("delete from TestTable where @ID=ID", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.AddParameter<int>("@ID", 1);
         Helper.ExecuteNonQuery();
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         if (Helper.Read())
         {
             Assert.False(true, "Nothing was deleted");
         }
     }
 }
コード例 #20
0
 public void CommandInsertNullString()
 {
     Guid TempGuid = Guid.NewGuid();
     Utilities.SQL.MicroORM.Command TempCommand = new Utilities.SQL.MicroORM.Command("insert into TestTable(StringValue1,StringValue2,BigIntValue,BitValue,DecimalValue,FloatValue,DateTimeValue,GUIDValue) VALUES (@0,@1,@2,@3,@4,@5,@6,@7)", CommandType.Text, "@", "Test String", null, 12345, true, 1234.5678m, 12345.6534f, new DateTime(1999, 12, 31), TempGuid);
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper(TempCommand, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteNonQuery();
     }
     using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", CommandType.Text, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false"))
     {
         Helper.ExecuteReader();
         if (Helper.Read())
         {
             Assert.Equal("Test String", Helper.GetParameter<string>("StringValue1", ""));
             Assert.Equal("This is a null string", Helper.GetParameter<string>("StringValue2", "This is a null string"));
             Assert.Equal(12345, Helper.GetParameter<long>("BigIntValue", 0));
             Assert.Equal(true, Helper.GetParameter<bool>("BitValue", false));
             Assert.Equal(1234.5678m, Helper.GetParameter<decimal>("DecimalValue", 0));
             Assert.Equal(12345.6534f, Helper.GetParameter<float>("FloatValue", 0));
             Assert.Equal(TempGuid, Helper.GetParameter<Guid>("GUIDValue", Guid.Empty));
             Assert.Equal(new DateTime(1999, 12, 31), Helper.GetParameter<DateTime>("DateTimeValue", DateTime.Now));
         }
         else
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
 }