Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tests/Dapper.Tests/AsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -995,5 +995,42 @@ public void AssertNoCacheWorksForQueryMultiple()
Assert.Equal(123, c);
Assert.Equal(456, d);
}

[Fact]
public async Task AssertNoCacheWorksForMultiMap()
{
const int a = 123, b = 456;
var cmdDef = new CommandDefinition("select @a as a, @b as b;", new
{
a,
b
}, commandType: CommandType.Text, flags: CommandFlags.NoCache | CommandFlags.Buffered);

SqlMapper.PurgeQueryCache();
var before = SqlMapper.GetCachedSQLCount();
Assert.Equal(0, before);

await MarsConnection.QueryAsync<int, int, (int, int)>(cmdDef, splitOn: "b", map: (a, b) => (a, b));
Assert.Equal(0, SqlMapper.GetCachedSQLCount());
Comment on lines +1013 to +1014
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails. SqlMapper.GetCachedSQLCount() actually returns 1

}


[Fact]
public async Task AssertNoCacheWorksForQueryAsync()
{
const int a = 123, b = 456;
var cmdDef = new CommandDefinition("select @a as a, @b as b;", new
{
a,
b
}, commandType: CommandType.Text, flags: CommandFlags.NoCache | CommandFlags.Buffered);

SqlMapper.PurgeQueryCache();
var before = SqlMapper.GetCachedSQLCount();
Assert.Equal(0, before);

await MarsConnection.QueryAsync<(int, int)>(cmdDef);
Assert.Equal(0, SqlMapper.GetCachedSQLCount());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this pass

}
}
}