you may also want to redesign your test to query the database after
the records are created to prove the database matches the input file.
testing the records were iterated over doesn't prove the records were
successfully written.

On Apr 6, 12:37 pm, Chris Hoffman <[email protected]> wrote:
> Additionally, a slight variation on the test process below *does*
> succeed.  Is there something stupid I'm missing with respect to making
> database connections within a test assembly?  I'm kinda learning this
> test framework at the same time I'm learning Rhino.ETL.
>
> Thanks.
>
> On Tue, Apr 6, 2010 at 12:13 PM, khaavren <[email protected]> wrote:
> > I can't for the life of me adapt
>
> >http://www.codeproject.com/KB/cs/ETLWithCSharp.aspx
>
> > to work with a database.  Here is the code (it is short enough that I
> > don't feel it cumbersome to just post it).  The Assert fails, and nor
> > do I receive an exception about database access, nor do I see any
> > activity in SQL Profiler.  It just doesn't work.  Could someone tell
> > me if I'm doing something blatantly wrong here?
>
> > Thanks.
>
> > the test:
>
> >    [TestClass]
> >    [DeploymentItem(@".\SampleData\names.txt", "SampleData")]
> >    public class UserNameWriteDBTest : BaseTestClass
> >    {
> >        [TestMethod]
> >        public void CanWriteDB()
> >        {
> >            var numprocessed = 0;
> >            var unr = new UserNameWriteToDB("uvmcar");
> >            unr.OnRowProcessed += delegate { numprocessed++ };
>
> >            var userRecords = new TestProcess(
> >                new UserNameRead(@".\SampleData\names.txt"),
> >                unr,
> >                new GetInputFromDB("uvmcar")
> >            );
>
> >            Assert.IsTrue(numprocessed > 0);
> >        }
> >    }
>
> > UserNameWriteToDB:
>
> >    public class UserNameWriteToDB : ConventionOutputCommandOperation
> >    {
> >        public UserNameWriteToDB(string connectionString) :
> >            base (connectionString){
> >            Command = "INSERT INTO Users (Id,Name) VALUES(@Id,@Name)";
> >        }
> >    }
>
> > GetInputFromDB:
>
> >    public class GetInputFromDB : ConventionInputCommandOperation
> >    {
> >        public GetInputFromDB(string connectionStringName)
> >            : base(connectionStringName){
> >            Command = "SELECT * FROM Users";
> >            }
> >    }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to