Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions pages/ef-mstest-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ A test without any attribute gets a new database per test, which is the most exp

In a `[NoDb]` test `Database` is null, and accessing `ArrangeData`, `ActData`, or `AssertData`, or calling `Reset`, throws.

In a database test, recording resumes on the first access of `ActData`. A `[NoDb]` test has no `ActData`, so recording is resumed when the test starts. Other recorded activity, such as NServiceBus messages sent by the code under test, still appears in the snapshot.

`[NoDb]` can also be applied to a test class. The nearest attribute wins, so a method marked `[PooledDb]`, `[SharedDb]`, or `[NewDb]` in a `[NoDb]` class gets a database. Applying `[NoDb]` together with `[PooledDb]`, `[SharedDb]` or `[NewDb]` to the same method or class throws.<!-- endInclude -->


Expand Down
2 changes: 2 additions & 0 deletions pages/ef-nunit-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ A test without any attribute gets a new database per test, which is the most exp

In a `[NoDb]` test `Database` is null, and accessing `ArrangeData`, `ActData`, or `AssertData`, or calling `Reset`, throws.

In a database test, recording resumes on the first access of `ActData`. A `[NoDb]` test has no `ActData`, so recording is resumed when the test starts. Other recorded activity, such as NServiceBus messages sent by the code under test, still appears in the snapshot.

`[NoDb]` can also be applied to a test class. The nearest attribute wins, so a method marked `[PooledDb]`, `[SharedDb]`, or `[NewDb]` in a `[NoDb]` class gets a database. Applying `[NoDb]` together with `[PooledDb]`, `[SharedDb]` or `[NewDb]` to the same method or class throws.<!-- endInclude -->


Expand Down
2 changes: 2 additions & 0 deletions pages/ef-tunit-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ A test without any attribute gets a new database per test, which is the most exp

In a `[NoDb]` test `Database` is null, and accessing `ArrangeData`, `ActData`, or `AssertData`, or calling `Reset`, throws.

In a database test, recording resumes on the first access of `ActData`. A `[NoDb]` test has no `ActData`, so recording is resumed when the test starts. Other recorded activity, such as NServiceBus messages sent by the code under test, still appears in the snapshot.

`[NoDb]` can also be applied to a test class. The nearest attribute wins, so a method marked `[PooledDb]`, `[SharedDb]`, or `[NewDb]` in a `[NoDb]` class gets a database. Applying `[NoDb]` together with `[PooledDb]`, `[SharedDb]` or `[NewDb]` to the same method or class throws.<!-- endInclude -->


Expand Down
2 changes: 2 additions & 0 deletions pages/ef-xunitv3-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ A test without any attribute gets a new database per test, which is the most exp

In a `[NoDb]` test `Database` is null, and accessing `ArrangeData`, `ActData`, or `AssertData`, or calling `Reset`, throws.

In a database test, recording resumes on the first access of `ActData`. A `[NoDb]` test has no `ActData`, so recording is resumed when the test starts. Other recorded activity, such as NServiceBus messages sent by the code under test, still appears in the snapshot.

`[NoDb]` can also be applied to a test class. The nearest attribute wins, so a method marked `[PooledDb]`, `[SharedDb]`, or `[NewDb]` in a `[NoDb]` class gets a database. Applying `[NoDb]` together with `[PooledDb]`, `[SharedDb]` or `[NewDb]` to the same method or class throws.<!-- endInclude -->


Expand Down
2 changes: 2 additions & 0 deletions pages/mdsource/no-db.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ A test without any attribute gets a new database per test, which is the most exp

In a `[NoDb]` test `Database` is null, and accessing `ArrangeData`, `ActData`, or `AssertData`, or calling `Reset`, throws.

In a database test, recording resumes on the first access of `ActData`. A `[NoDb]` test has no `ActData`, so recording is resumed when the test starts. Other recorded activity, such as NServiceBus messages sent by the code under test, still appears in the snapshot.

`[NoDb]` can also be applied to a test class. The nearest attribute wins, so a method marked `[PooledDb]`, `[SharedDb]`, or `[NewDb]` in a `[NoDb]` class gets a database. Applying `[NoDb]` together with `[PooledDb]`, `[SharedDb]` or `[NewDb]` to the same method or class throws.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CA1416;CS8632;NU1608;NU1109</NoWarn>
<Version>27.2.1</Version>
<Version>27.2.2</Version>
<LangVersion>preview</LangVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
Expand Down
5 changes: 5 additions & 0 deletions src/EfLocalDb.MSTest.Tests/NoDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public void ArrangeDataThrows()
Assert.Contains("[NoDb]", exception.Message);
}

[TestMethod]
[NoDb]
public void IsRecording() =>
Assert.IsTrue(Recording.IsRecording());

[TestMethod]
[NoDb]
public async Task ResetThrows() =>
Expand Down
3 changes: 3 additions & 0 deletions src/EfLocalDb.MSTest/LocalDbTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public virtual Task SetUp()
QueryFilter.Enable();
if (isNoDb)
{
// ActData is what resumes recording, and a [NoDb] test has none,
// so resume here to still record other activity such as sent messages
Recording.Resume();
return Task.CompletedTask;
}

Expand Down
5 changes: 5 additions & 0 deletions src/EfLocalDb.NUnit.Tests/NoDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public void ArrangeDataThrows()
That(exception.Message, Does.Contain("[NoDb]"));
}

[Test]
[NoDb]
public void IsRecording() =>
That(Recording.IsRecording(), Is.True);

[Test]
[NoDb]
public void ResetThrows() =>
Expand Down
3 changes: 3 additions & 0 deletions src/EfLocalDb.NUnit/LocalDbTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public virtual Task SetUp()
QueryFilter.Enable();
if (isNoDb)
{
// ActData is what resumes recording, and a [NoDb] test has none,
// so resume here to still record other activity such as sent messages
Recording.Resume();
return Task.CompletedTask;
}

Expand Down
5 changes: 5 additions & 0 deletions src/EfLocalDb.TUnit.Tests/NoDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public async Task ArrangeDataThrows()
await Assert.That(exception!.Message).Contains("[NoDb]");
}

[Test]
[NoDb]
public async Task IsRecording() =>
await Assert.That(Recording.IsRecording()).IsTrue();

[Test]
[NoDb]
public async Task ResetThrows() =>
Expand Down
3 changes: 3 additions & 0 deletions src/EfLocalDb.TUnit/LocalDbTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public virtual Task SetUp()

if (isNoDb)
{
// ActData is what resumes recording, and a [NoDb] test has none,
// so resume here to still record other activity such as sent messages
Recording.Resume();
return Task.CompletedTask;
}

Expand Down
5 changes: 5 additions & 0 deletions src/EfLocalDb.Xunit.V3.Tests/NoDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public void ArrangeDataThrows()
Assert.Contains("[NoDb]", exception.Message);
}

[Fact]
[NoDb]
public void IsRecording() =>
Assert.True(Recording.IsRecording());

[Fact]
[NoDb]
public Task ResetThrows() =>
Expand Down
3 changes: 3 additions & 0 deletions src/EfLocalDb.Xunit.V3/LocalDbTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public virtual async ValueTask InitializeAsync()
QueryFilter.Enable();
if (isNoDb)
{
// ActData is what resumes recording, and a [NoDb] test has none,
// so resume here to still record other activity such as sent messages
Recording.Resume();
return;
}

Expand Down
Loading