/// <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(); }
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); }
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); }
/// <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(); }
/// <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); }
/// <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); }
public void GetTableName_CustomConventionNamedRegisteredOnMethod_GetsExpectedTableName() { var finder = new ConventionFinder(); Assert.AreEqual("METHOD_DateTime", finder.GetTableName <DateTime>()); }
public void GetTableName_CustomConventionRegisteredOnClass_GetsExpectedTableName() { var finder = new ConventionFinder(); Assert.AreEqual("tbl_DateTime", finder.GetTableName <DateTime>()); }
public void GetTableName_CustomConventionNamedRegisteredOnClass_GetsExpectedTableName() { var finder = new ConventionFinder(); Assert.AreEqual("EntityXXX", finder.GetTableName <Entity>()); }
public void GetTableName_ShouldUseNamedDecoration_TableNameAccordingToNamedDecoration() { var finder = new ConventionFinder(); Assert.AreEqual("TStringBuilder", finder.GetTableName <StringBuilder>()); }
public void GetTableName_NamedDecorationOnBothMethodAndClass_UsesDecorationFromMethod() { var finder = new ConventionFinder(); Assert.AreEqual("XXStringBuilder", finder.GetTableName <StringBuilder>()); }
public void GetTableName_DefaultDecorationFromClass_TableNameAccordingToConvention() { var finder = new ConventionFinder(); Assert.AreEqual("TBL_DateTime", finder.GetTableName <DateTime>()); }
public void GetTableName_DecorationOnBothMethodAndClass_TableNameAccordingMethodDecoration() { var finder = new ConventionFinder(); Assert.AreEqual("DateTime", finder.GetTableName <DateTime>()); }
public void GetTableName_DecorationOnBothMethodAndClass_TableNameAccordingMethodDecoration() { var finder = new ConventionFinder(); Assert.AreEqual("DateTime", finder.GetTableName<DateTime>()); }
public void GetTableName_CustomConventionNamedRegisteredOnClassAndNamedAttribOnMethod_GetsExpectedTableName() { var finder = new ConventionFinder(); Assert.AreEqual("EntityYYY", finder.GetTableName <Entity>()); }
public void GetTableName_DefaultDecorationFromClass_TableNameAccordingToConvention() { var finder = new ConventionFinder(); Assert.AreEqual("TBL_DateTime", finder.GetTableName<DateTime>()); }
public void GetTableName_ShouldUseNamedDecoration_TableNameAccordingToNamedDecoration() { var finder = new ConventionFinder(); Assert.AreEqual("TStringBuilder", finder.GetTableName<StringBuilder>()); }
public void GetTableName_NamedDecorationOnBothMethodAndClass_UsesDecorationFromMethod() { var finder = new ConventionFinder(); Assert.AreEqual("XXStringBuilder", finder.GetTableName<StringBuilder>()); }
public void GetTableName_NoDecorations_TableNameEqualsClassName() { var finder = new ConventionFinder(); Assert.AreEqual(finder.GetTableName <DateTime>(), "DateTime"); }
public void GetTableName_NoDecorations_TableNameEqualsClassName() { var finder = new ConventionFinder(); Assert.AreEqual(finder.GetTableName<DateTime>(), "DateTime"); }