XUnitTestCommandAsSql/UnitTest1.cs
/// <summary>
/// Test a regular sql string with an int parameter
/// </summary>
Test a regular sql string with an int parameter
Test a regular sql string with an int parameter
[Fact(DisplayName = "Compare Command With Int Parameter")]
        public void Compare_Command_With_Int_Parameter()
        {
            const string Expected = "select * from products where productid = 1";
            var sc = new SqlCommand("select * from products where productid = @id");
            sc.Parameters.AddWithValue("@id", 1); 
            var c = sc.CommandAsSql().Replace("\r\n", string.Empty); 
            Assert.Equal(Expected, c);
        }
[ Fact ( DisplayName = " " ) ] public void Compare_Command_With_Int_Parameter ( ) { const string Expected = " " ; var sc = new SqlCommand ( " " ) ; sc . Parameters . AddWithValue ( " " , 1 ) ; var c = sc . CommandAsSql ( ) . Replace ( " \r \n " , string . Empty ) ; Assert . Equal ( Expected , c ) ; }
Test a regular sql string with an int parameter
Test a regular sql string with an int parameter
// arrange // if you forget the @ here, the test fails. Give your thoughts about this in the GitHub issues section please. // act // not too happy about removing the newline // assert