Ejemplo n.º 1
0
        public void Verify(ParameterList actualList)
        {
            var expectedKeys = new ArrayList(AllKeys);
            var actualKeys = new ArrayList(actualList.AllKeys);
            var unionKeys = new ArrayList();

            var keys = (string[]) actualKeys.ToArray(typeof (string));

            foreach (string key in keys)
            {
                if (expectedKeys.Contains(key))
                {
                    unionKeys.Add(key);
                    expectedKeys.Remove(key);
                    actualKeys.Remove(key);
                }
            }

            var failureCondition = new ParameterValidationFailureException();

            checkForWrongParameterValues(unionKeys, actualList, failureCondition);
            checkForMissingParameters(expectedKeys, failureCondition);
            checkForUnExpectedParameters(actualList, actualKeys, failureCondition);

            failureCondition.ThrowIfExceptions();
        }
        public int VerifyExecution(ParameterList list)
        {
            _inputs.Verify(list);
            _wasExecuted = true;

            return _rowsAffected;
        }
Ejemplo n.º 3
0
        public object Clone()
        {
            var clone = new ParameterList();
            clone._values = (Hashtable) _values.Clone();

            return clone;
        }
 public CommandExpectation(ParameterList inputs, ParameterList outputs, int rowsAffected)
 {
     _inputs = inputs;
     _outputs = outputs;
     _rowsAffected = rowsAffected;
 }
 public CommandExpectation(int rowsAffected)
 {
     _rowsAffected = rowsAffected;
     _inputs = new ParameterList();
     _outputs = new ParameterList();
 }
Ejemplo n.º 6
0
 public MockReaderSource(string name)
 {
     Name = name;
     _parameters = new ParameterList();
     _expectations = new Queue();
 }
Ejemplo n.º 7
0
 public MockCommand(string name)
 {
     Name = name;
     _expectations = new Queue();
     _inputs = new ParameterList();
 }
Ejemplo n.º 8
0
        private void checkForWrongParameterValues(ArrayList unionKeys, ParameterList actualList,
            ParameterValidationFailureException failureCondition)
        {
            foreach (string key in unionKeys)
            {
                object expected = this[key];
                object actual = actualList[key];

                if (!expected.Equals(actual))
                {
                    failureCondition.MarkWrongParameterValue(key, expected, actual);
                }
            }
        }
        public IDataReader VerifyAndGetReader(ParameterList actualParameters)
        {
            _parameters.Verify(actualParameters);

            return _result;
        }
Ejemplo n.º 10
0
 private void checkForUnExpectedParameters(ParameterList list, ArrayList keys,
     ParameterValidationFailureException condition)
 {
     foreach (string key in keys)
     {
         condition.MarkUnexpectedParameter(key, list[key]);
     }
 }
 public ReaderExpectation(ParameterList parameters, IDataReader result)
 {
     _parameters = parameters;
     _result = result;
 }
 public ReaderExpectation(IDataReader result)
 {
     _result = result;
     _parameters = new ParameterList();
 }
Ejemplo n.º 13
0
 public MockReaderSource(string name)
 {
     Name          = name;
     _parameters   = new ParameterList();
     _expectations = new Queue();
 }
 public CommandExpectation(ParameterList inputs, ParameterList outputs, int rowsAffected)
 {
     _inputs       = inputs;
     _outputs      = outputs;
     _rowsAffected = rowsAffected;
 }
 public CommandExpectation(int rowsAffected)
 {
     _rowsAffected = rowsAffected;
     _inputs       = new ParameterList();
     _outputs      = new ParameterList();
 }