Exemple #1
0
        public void Format_WhenUpperInclusive_ExpectCorrectSql()
        {
            // Arrange
            var rangeFormatter = new RangeFormatter();

            var node = new RangeOperator
            {
                Name           = "ColumnName",
                Lower          = 25,
                Upper          = 100,
                LowerInclusive = false,
                UpperInclusive = true,
            };

            // Act
            var stopwatch       = Stopwatch.StartNew();
            var sqlDataResponse = rangeFormatter.Format(node, 0);

            stopwatch.Stop();

            // Assert
            this.WriteTimeElapsed(stopwatch);

            Assert.That(sqlDataResponse.Sql, Is.EqualTo("ColumnName > @ColumnName0 AND ColumnName <= @ColumnName1"));
            Assert.That(sqlDataResponse.Params.First(r => r.VarName == "ColumnName0").Value, Is.EqualTo(25));
            Assert.That(sqlDataResponse.Params.First(r => r.VarName == "ColumnName1").Value, Is.EqualTo(100));
        }