Example #1
0
        public void Execute()
        {
            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"))
            {
                for (int x = 0; x < 100; ++x)
                {
                    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"))
            {
                bool Inserted = false;
                foreach (dynamic Object in Helper.Execute())
                {
                    Inserted = true;
                    Assert.Equal("Test String", Object.StringValue1);
                    Assert.Equal <string>(null, (string)Object.StringValue2);
                    Assert.Equal(12345, Object.BigIntValue);
                    Assert.Equal(true, Object.BitValue);
                    Assert.Equal(1234.5678m, Object.DecimalValue);
                    Assert.Equal(12345.6534f, Object.FloatValue);
                    Assert.Equal(TempGuid, Object.GUIDValue);
                    Assert.Equal(new DateTime(1999, 12, 31), Object.DateTimeValue);
                }
                if (!Inserted)
                {
                    Assert.False(true, "Nothing was inserted");
                }
            }
        }
 public void Execute()
 {
     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"))
     {
         for (int x = 0; x < 100; ++x)
             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"))
     {
         bool Inserted = false;
         foreach (dynamic Object in Helper.Execute())
         {
             Inserted = true;
             Assert.Equal("Test String", Object.StringValue1);
             Assert.Equal<string>(null, (string)Object.StringValue2);
             Assert.Equal(12345, Object.BigIntValue);
             Assert.Equal(true, Object.BitValue);
             Assert.Equal(1234.5678m, Object.DecimalValue);
             Assert.Equal(12345.6534f, Object.FloatValue);
             Assert.Equal(TempGuid, Object.GUIDValue);
             Assert.Equal(new DateTime(1999, 12, 31), Object.DateTimeValue);
         }
         if (!Inserted)
         {
             Assert.False(true, "Nothing was inserted");
         }
     }
 }