public void ExecuteBatchString()
        {
            SetupCommandExpectations("ABCDEFG", null, delegate { Expect.Call(_commandMock.ExecuteNonQuery()).Return(5); });

            _mockRepository.ReplayAll();

            TestableDatabaseAgent agent = new TestableDatabaseAgent(_connectionStub);
            int result = agent.ExecuteBatchString(_connectionStub, "ABCDEFG", null);

            _mockRepository.VerifyAll();
            Assert.That(result, Is.EqualTo(5));
        }
        public void ExecuteScalarCommand()
        {
            SetupCommandExpectations("my command", null, delegate { Expect.Call(_commandMock.ExecuteScalar()).Return("foo"); });

            _mockRepository.ReplayAll();

            TestableDatabaseAgent agent = new TestableDatabaseAgent(_connectionStub);
            object result = agent.ExecuteScalarCommand("my command");

            Assert.That(result, Is.EqualTo("foo"));

            _mockRepository.VerifyAll();
        }
        public void ExecuteCommand_ReturnsCount()
        {
            SetupCommandExpectations("my command", null, delegate { Expect.Call(_commandMock.ExecuteNonQuery()).Return(15); });

            _mockRepository.ReplayAll();

            TestableDatabaseAgent agent = new TestableDatabaseAgent(_connectionStub);
            int result = agent.ExecuteCommand("my command");

            Assert.That(result, Is.EqualTo(15));

            _mockRepository.VerifyAll();
        }
        public void ExecuteBatchString_EmptyLines()
        {
            SetupCommandExpectations("ABC", null, delegate { Expect.Call(_commandMock.ExecuteNonQuery()).Return(10); });
            SetupCommandExpectations("GFE", null, delegate { Expect.Call(_commandMock.ExecuteNonQuery()).Return(20); });

            _mockRepository.ReplayAll();

            TestableDatabaseAgent agent = new TestableDatabaseAgent(_connectionStub);
            int result = agent.ExecuteBatchString(_connectionStub, "ABC\n\nGO\n\n\nGFE\n\n", null);

            _mockRepository.VerifyAll();
            Assert.That(result, Is.EqualTo(30));
        }