/// <summary> /// Check that the properties are initialized. /// </summary> /// <param name="message">The message.</param> /// <exception cref="PropertiesCheckFailure{T}"></exception> public void AreInitialized(string message = null) { var trace = new CheckingTrace(); if (!ObjectTester.PropertiesAreInitialized(_value, trace, _options)) { // ReSharper disable once UnthrowableException throw _factory.Build(new PropertiesCheckFailure <T>(CheckType.PropertiesInitialized, _value, default(T), trace, message)); } }
/// <summary> /// Check that the properties are equal to properties of another type /// </summary> /// <param name="expected">The expected.</param> /// <param name="message">The message.</param> /// <exception cref="PropertiesCheckFailure{T}"></exception> public void AreEqualToPropertiesOf(T expected, string message = null) { var trace = new CheckingTrace(); if (!ObjectComparer.PropertiesAreEqual(_value, expected, trace, _options)) { // ReSharper disable once UnthrowableException throw _factory.Build(new PropertiesCheckFailure <T>(CheckType.PropertiesEqual, _value, expected, trace, message)); } }
/// <summary> /// Checks the Inner is not equal to /// </summary> /// <param name="expected">The expected.</param> /// <param name="message">The message.</param> /// <returns></returns> /// <exception cref="ObjectCheckFailure"></exception> protected override bool InnerIsNotEqualTo(T expected, string message = null) { var trace = new CheckingTrace(); if (ObjectComparer.ObjectsAreEqual(_value, expected, PropertiesComparisonOptions.Default, trace)) { // ReSharper disable once UnthrowableException throw _factory.Build(new ObjectCheckFailure(CheckType.NotEqual, _value, expected, trace, message)); } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="PropertiesCheckFailure{T}" /> class. /// </summary> /// <param name="type">The type.</param> /// <param name="tested">The tested.</param> /// <param name="expected">The expected.</param> /// <param name="trace">The trace.</param> /// <param name="message">The message.</param> public PropertiesCheckFailure(CheckType type, T tested, T expected, CheckingTrace trace, string message) : base( type, tested, expected, message) { _trace = trace; }
/// <summary> /// Initializes a new instance of the <see cref="ObjectCheckFailure" /> class. /// </summary> /// <param name="type">The type.</param> /// <param name="tested">The tested.</param> /// <param name="expected">The expected.</param> /// <param name="trace">The trace.</param> /// <param name="message">The message.</param> public ObjectCheckFailure(CheckType type, object tested, object expected, CheckingTrace trace, string message) : base(type, tested, expected, message) { _trace = trace; }