-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fallback to Scope Stack from AspNet. (#1180)
* Add fallback to scopeStack. * Add changelog.
- Loading branch information
1 parent
5a305f8
commit f47367c
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/Sentry.AspNet.Tests/Internal/SentryScopeManagerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using NSubstitute; | ||
using Sentry.AspNet.Internal; | ||
using Sentry.Internal; | ||
using Xunit; | ||
|
||
namespace Sentry.AspNet.Tests.Internal | ||
{ | ||
public class SentryScopeManagerTests | ||
{ | ||
private class Fixture | ||
{ | ||
public SentryScopeManager GetSut() => new SentryScopeManager( | ||
new HttpContextScopeStackContainer(), | ||
new SentryOptions(), | ||
Substitute.For<ISentryClient>()); | ||
} | ||
|
||
private Fixture _fixture => new(); | ||
|
||
[Fact] | ||
public void SetScopeStack_NoHttpContext_FallbackSet() | ||
{ | ||
// Arrange | ||
var scopeManager = _fixture.GetSut(); | ||
|
||
// Act | ||
scopeManager.PushScope(); | ||
|
||
// Assert | ||
Assert.NotNull(scopeManager.ScopeStackContainer.Stack); | ||
} | ||
|
||
[Fact] | ||
public void GetScopeStack_NoHttpContext_Null() | ||
{ | ||
// Arrange | ||
var scopeManager = _fixture.GetSut(); | ||
|
||
// Assert | ||
Assert.Null(scopeManager.ScopeStackContainer.Stack); | ||
} | ||
} | ||
} |