Example #1
0
 /// <summary>Initializes a new instance of the <see cref="CallData"/> class.</summary>
 /// <param name="methodName">Name tied to the call.</param>
 /// <param name="generics">Generics tied to the call.</param>
 /// <param name="args">Args tied to the call.</param>
 /// <param name="valuer">How to compare call data.</param>
 internal CallData(string methodName, Type[] generics, object[] args, IValuer valuer)
 {
     _methodName = methodName ?? throw new ArgumentNullException(nameof(methodName));
     _generics   = generics ?? throw new ArgumentNullException(nameof(generics));
     _args       = args ?? throw new ArgumentNullException(nameof(args));
     _valuer     = valuer;
 }
        /// <summary>Compares by value.</summary>
        /// <param name="other">Instance to compare with.</param>
        /// <param name="valuer">Handles callback behavior for child values.</param>
        /// <returns>True if equal; false otherwise.</returns>
        public virtual bool ValuesEqual(object other, IValuer valuer)
        {
            if (valuer == null)
            {
                throw new ArgumentNullException(nameof(valuer));
            }

            return((other is PrivateValuerEquatableSample sample) &&
                   valuer.Equals(StringValue, sample.StringValue));
        }
Example #3
0
 /// <summary>Initializes a new instance of the <see cref="AssertGroup"/> class.</summary>
 /// <inheritdoc/>
 internal AssertGroup(IRandom gen, IValuer valuer, IEnumerable collection) : base(gen, valuer, collection)
 {
 }
 /// <summary>Initializes a new instance of the <see cref="AssertComparable"/> class.</summary>
 /// <inheritdoc/>
 internal AssertComparable(IRandom gen, IValuer valuer, IComparable value) : base(gen, valuer, value)
 {
 }
 /// <summary>Generates a hash based upon value.</summary>
 /// <param name="valuer">Handles callback behavior for child values.</param>
 /// <returns>The generated hash code.</returns>
 public virtual int GetValueHash(IValuer valuer)
 {
     return(valuer?.GetHashCode(StringValue) ?? throw new ArgumentNullException(nameof(valuer)));
 }
Example #6
0
 /// <summary>Initializes a new instance of the <see cref="AssertChainer{T}"/> class.</summary>
 /// <param name="chain">Assertion class to chain.</param>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 public AssertChainer(T chain, IRandom gen, IValuer valuer)
 {
     _gen    = gen;
     _valuer = valuer;
     And     = chain;
 }
Example #7
0
 /// <summary>Initializes a new instance of the <see cref="Faker"/> class.</summary>
 /// <param name="valuer">Handles comparisons.</param>
 public Faker(IValuer valuer)
 {
     _valuer = valuer;
 }
 /// <summary>Initializes a new instance of the <see cref="AssertBehavior"/> class.</summary>
 /// <inheritdoc/>
 internal AssertBehavior(IRandom gen, IValuer valuer, Delegate behavior) : base(gen, valuer, behavior)
 {
 }
Example #9
0
 /// <summary>Initializes a new instance of the <see cref="Asserter"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <exception cref="ArgumentNullException">If given a null valuer.</exception>
 public Asserter(IRandom gen, IValuer valuer)
 {
     Gen    = gen ?? throw new ArgumentNullException(nameof(gen));
     Valuer = valuer ?? throw new ArgumentNullException(nameof(valuer));
 }
Example #10
0
 /// <summary>Initializes a new instance of the <see cref="AssertObject"/> class.</summary>
 /// <inheritdoc/>
 internal AssertObject(IRandom gen, IValuer valuer, object actual) : base(gen, valuer, actual)
 {
 }
Example #11
0
 /// <summary>Initializes a new instance of the <see cref="AssertObjectBase{T}"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <param name="actual">Object to compare with.</param>
 protected AssertObjectBase(IRandom gen, IValuer valuer, object actual)
 {
     Gen    = gen ?? throw new ArgumentNullException(nameof(gen));
     Valuer = valuer ?? throw new ArgumentNullException(nameof(valuer));
     Actual = actual;
 }
 /// <summary>Initializes a new instance of the <see cref="AssertBehaviorBase{T}"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <param name="behavior">Delegate to check.</param>
 protected AssertBehaviorBase(IRandom gen, IValuer valuer, Delegate behavior) : base(gen, valuer, behavior)
 {
     Behavior = behavior;
 }
 /// <summary>Initializes a new instance of the <see cref="AssertGroupBase{T}"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <param name="collection">Collection to check.</param>
 protected AssertGroupBase(IRandom gen, IValuer valuer, IEnumerable collection) : base(gen, valuer, collection)
 {
     Collection = collection;
 }
Example #14
0
 /// <summary>Initializes a new instance of the <see cref="AssertText"/> class.</summary>
 /// <inheritdoc/>
 internal AssertText(IRandom gen, IValuer valuer, string text) : base(gen, valuer, text)
 {
 }
Example #15
0
 /// <summary>Initializes a new instance of the <see cref="AssertTextBase{T}"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <param name="text">Text to check.</param>
 protected AssertTextBase(IRandom gen, IValuer valuer, string text) : base(gen, valuer, text)
 {
     Text = text;
 }
Example #16
0
 /// <summary>Initializes a new instance of the <see cref="Mutator"/> class.</summary>
 /// <param name="randomizer">Handles randomization.</param>
 /// <param name="valuer">Ensures object variance.</param>
 /// <param name="limiter">Limits attempts at creating variants.</param>
 public Mutator(IRandomizer randomizer, IValuer valuer, Limiter limiter)
 {
     _randomizer = randomizer ?? throw new ArgumentNullException(nameof(randomizer));
     _valuer     = valuer ?? throw new ArgumentNullException(nameof(valuer));
     _limiter    = limiter ?? throw new ArgumentNullException(nameof(limiter));
 }
Example #17
0
 /// <summary>Initializes a new instance of the <see cref="AssertComparableBase{T}"/> class.</summary>
 /// <param name="gen">Core value random handler.</param>
 /// <param name="valuer">Handles comparisons.</param>
 /// <param name="value">Value to check.</param>
 protected AssertComparableBase(IRandom gen, IValuer valuer, IComparable value) : base(gen, valuer, value)
 {
     Value = value;
 }