Skip to content

Mocking Multiple queries #30

Description

@psyciknz

I have managed to successfully mock a query using:

var conn = new Apps72.Dev.Data.DbMocker.MockDbConnection();
            conn.Mocks
                .When(cmd => cmd.CommandText.StartsWith("SELECT 1 FROM "))
                .ReturnsScalar<int>(1);

Then in one method I have the following query that matches teh command text:

command.CommandText = "SELECT 1 FROM " + this.headerTable + " WHERE JobID='" + this.jobId  '";
int result = command.ExecutNonQuery();

But then further down in teh same method I have

command.CommandText = "SELECT 2 FROM " + this.headerTable + " WHERE JobID='" + this.jobId  '";
int result = command.ExecutNonQuery();

How can I add a mock result for startswith("Select 2 from")

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions