Esempio n. 1
0
 /// <summary>
 /// Checks that the entity is stored in the database as
 /// expected according to the conventions registered for
 /// the test.
 /// </summary>
 /// <param name="entity"></param>
 public static void Exists(object entity)
 {
     var finder = new ConventionFinder();
     ForTable(finder.GetTableName(entity))
         .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
         .Exists();
 }
Esempio n. 2
0
 public static void Evaluate(object entity, Func<ISqlResult, bool> evaluationFunction)
 {
     var finder = new ConventionFinder();
     ForTable(finder.GetTableName(entity))
         .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
         .Evaluate(evaluationFunction);
 }
Esempio n. 3
0
        /// <summary>
        /// Checks that the entity is not stored in the database
        /// according to the conventions registered for the test.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public static void NotExists(object entity)
        {
            var finder = new ConventionFinder();

            ForTable(finder.GetTableName(entity))
            .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
            .NotExists();
        }
Esempio n. 4
0
        public static void Evaluate(object entity, Func <ISqlResult, bool> evaluationFunction)
        {
            var finder = new ConventionFinder();

            ForTable(finder.GetTableName(entity))
            .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
            .Evaluate(evaluationFunction);
        }
Esempio n. 5
0
        /// <summary>
        /// Checks that the value for the named property of the entity
        /// equals the corresponding value stored in the database
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        public static void ColumnEquals(object entity, string propertyName)
        {
            var method = entity.GetType()
                .GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public)
                .GetGetMethod();
            object valInObject = method.Invoke(entity, new object[0]);

            var finder = new ConventionFinder();
            ForTable(finder.GetTableName(entity))
                .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
                .AreEqual(propertyName, valInObject);
        }
Esempio n. 6
0
        /// <summary>
        /// Checks that the value for the named property of the entity
        /// equals the corresponding value stored in the database
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        public static void ColumnEquals(object entity, string propertyName)
        {
            var method = entity.GetType()
                         .GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public)
                         .GetGetMethod();
            object valInObject = method.Invoke(entity, new object[0]);

            var finder = new ConventionFinder();

            ForTable(finder.GetTableName(entity))
            .WithColumnValuePair(finder.GetIdProperty(entity), finder.GetId(entity))
            .AreEqual(propertyName, valInObject);
        }