Ejemplo n.º 1
0
        public void should_get_one_result(
            [Values(FirstBatch, "")] string firstBatch)
        {
            var result = SqlStatement.ExecuteSingle <Entity>($"{firstBatch}SELECT TOP 1 * FROM {Database.FirstTable.Name} WHERE Id=@Id", new { Id = 5 });

            result.ShouldNotBeNull();
            result.Name.Length.ShouldBeGreaterThan(3);
            result.Id.ShouldEqual(5);
            result.Values.Count.ShouldEqual(2);
            ((bool)result.Values["hide"]).ShouldEqual(false);
            ((DateTime)result.Values["timestamp"]).ShouldBeGreaterThan(DateTime.MinValue);
        }
Ejemplo n.º 2
0
 public static TEntity ExecuteSingle <TEntity>(this ISqlStatement sqlStatement,
                                               string commandText, object parameters) where TEntity : class
 {
     return(sqlStatement.ExecuteSingle <TEntity>(commandText, parameters.AsDictionary()));
 }