コード例 #1
0
        public void ShouldParseDatabaseAndServer()
        {
            var sut = new SqlServerSession("Data Source=myHost;Initial Catalog=myBase;Integrated Security=True");

            Assert.That(sut.Database, Is.EqualTo("myBase"));
            Assert.That(sut.Server, Is.EqualTo("myHost"));
        }
コード例 #2
0
        public void ShouldExecuteProcedureOnTransaction()
        {
            var factory    = new Mock <IConnectionFactory>();
            var connection = new Mock <IConnection>();

            factory.Setup(x => x.Create("A")).Returns(connection.Object);

            var sut = new SqlServerSession(factory.Object, "A");

            sut.ExecuteProcedureOnTransaction("A");

            connection.Verify(x => x.ExecuteOnTransaction("A", null, CommandType.StoredProcedure));
        }
コード例 #3
0
        public void ShouldExecuteProcedureBatch()
        {
            var factory    = new Mock <IConnectionFactory>();
            var connection = new Mock <IConnection>();

            factory.Setup(x => x.Create("A")).Returns(connection.Object);
            var parameterSet = new[] { new ParameterSet() };

            var sut = new SqlServerSession(factory.Object, "A");

            sut.ExecuteProcedureBatch("A", parameterSet);

            connection.Verify(x => x.ExecuteBatch("A", parameterSet, CommandType.StoredProcedure));
        }