Example #1
0
        public void generateInsertSqlString_ReturnsProperString_ForSingleElementAndEmptyDbAppendix()
        {
            DbStringBuilder builder = new DbStringBuilder();

            builder.DbAppendix = string.Empty;
            builder.Add("Value", 1);

            string expected = "INSERT INTO {0}(Value) VALUES(1);";

            Assert.AreEqual(expected, builder.GenerateInsertSqlString());
        }
Example #2
0
        public void generateInsertSqlString_ReturnsProperString_ForManyElements()
        {
            DbStringBuilder builder = new DbStringBuilder();

            builder.DbAppendix = "fx";
            builder.Add("Value", 1);
            builder.Add("Name", "abc");
            builder.Add("Date", new DateTime(2017, 3, 12));
            builder.Add("IsActive", true);

            string expected = "INSERT INTO fx.{0}(Value, Name, Date, IsActive) VALUES(1, 'abc', '2017-03-12 00:00:00', 1);";

            Assert.AreEqual(expected, builder.GenerateInsertSqlString());
        }