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")); }
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)); }
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)); }