public int[] GetIndices()
        {
            var indices = new List <int>();

            Digit digit = this;

            while (digit != null)
            {
                indices.Add(digit.index);
                digit = digit.nextDigit;
            }

            return(indices.ToArray());
        }
        public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent,
                           IEquivalencyAssertionOptions config)
        {
            Array expectationAsArray = (Array)context.Expectation;

            if (AreComparable(context, expectationAsArray))
            {
                Digit digit = BuildDigitsRepresentingAllIndices(expectationAsArray);

                do
                {
                    var subject = ((Array)context.Subject).GetValue(digit.Indices);
                    IEquivalencyValidationContext itemContext = context.CreateForCollectionItem(
                        string.Join(",", digit.Indices),
                        subject,
                        expectationAsArray.GetValue(digit.Indices));

                    parent.AssertEqualityUsing(itemContext);
                }while (digit.Increment());
            }

            return(true);
        }
 public Digit(int length, Digit nextDigit)
 {
     this.length    = length;
     this.nextDigit = nextDigit;
 }
 public Digit(int length, Digit nextDigit)
 {
     this.length = length;
     this.nextDigit = nextDigit;
 }