Exemple #1
0
        public void AddParameters_OneValue()
        {
            var specification = new ComparedColumnsSpecification(new[] { new ColumnValue(_column1, _value1) });

            _sqlDialectStub.Stub(stub => stub.GetParameterName("First")).Return("pFirst");

            var parameterStrictMock = MockRepository.GenerateStrictMock <IDbDataParameter> ();

            parameterStrictMock.Expect(mock => mock.ParameterName = "pFirst");
            parameterStrictMock.Replay();

            _parametersCollectionMock.Expect(mock => mock.Add(parameterStrictMock)).Return(0);
            _parametersCollectionMock.Replay();

            _storageTypeInformationMock1
            .Expect(mock => mock.CreateDataParameter(_commandStub, _value1))
            .Return(parameterStrictMock);
            _storageTypeInformationMock1.Replay();

            specification.AddParameters(_commandStub, _sqlDialectStub);

            _parametersCollectionMock.VerifyAllExpectations();
            parameterStrictMock.VerifyAllExpectations();
            _storageTypeInformationMock1.VerifyAllExpectations();
        }
        public void AddParameters()
        {
            _sqlDialectStub.Stub(stub => stub.GetParameterName("Column")).Return("pColumn");

            _parametersCollectionMock.Expect(mock => mock.Add(_parameterStub)).Return(0);
            _parametersCollectionMock.Replay();

            _specification.AddParameters(_commandStub, _sqlDialectStub);

            _parametersCollectionMock.VerifyAllExpectations();

            Assert.That(_parameterStub.Value, Is.EqualTo("<L><I>&lt;Test1</I><I>689</I><I>True</I></L>"));
            Assert.That(_parameterStub.DbType, Is.EqualTo(DbType.Xml));
            Assert.That(_parameterStub.ParameterName, Is.EqualTo("pColumn"));
        }