public void Should_Not_Produce_A_Trailing_Comma_After_The_Last_Parameter_In_The_Values_List()
        {
            // Arrange
            var customer = new ClassWithTheLastFieldNullable {
                Ant = 1, Baboon = "broom"
            };

            DbCommand dbCommand = new SqlCommand();

            // Act
            dbCommand = new InsertCommandSqlBuilder(DatabaseEngine.SqlServer).AppendInsert(dbCommand, customer, "INSERT INTO {0} ({1}) VALUES({2});");

            // Assert
            Assert.IsNotNull(dbCommand.CommandText);
            Assert.IsFalse(dbCommand.CommandText.Contains(",);"));
        }
Ejemplo n.º 2
0
        public void Should_Not_Produce_A_Trailing_Comma_After_The_Last_Parameter_In_The_Values_List()
        {
            // Arrange
            var customer = new ClassWithTheLastFieldNullable { Ant = 1, Baboon = "broom" };

            DbCommand dbCommand = TestHelpers.GetDbCommand();

            // Act
            dbCommand = dbCommand.GenerateInsertCommand( customer, "INSERT INTO {0} ({1}) VALUES({2});" );

            // Visual Assertion
            Trace.WriteLine( dbCommand.CommandText );

            // Assert
            Assert.NotNull( dbCommand.CommandText );
            Assert.False( dbCommand.CommandText.Contains( ",);" ) );
        }
Ejemplo n.º 3
0
        public void Should_Not_Produce_A_Trailing_Comma_After_The_Last_Parameter_In_The_Values_List()
        {
            // Arrange
            var customer = new ClassWithTheLastFieldNullable {
                Ant = 1, Baboon = "broom"
            };

            DbCommand dbCommand = TestHelpers.GetDbCommand();

            // Act
            dbCommand = dbCommand.GenerateInsertCommand(customer, "INSERT INTO {0} ({1}) VALUES({2});");

            // Visual Assertion
            Trace.WriteLine(dbCommand.CommandText);

            // Assert
            Assert.NotNull(dbCommand.CommandText);
            Assert.False(dbCommand.CommandText.Contains(",);"));
        }