This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for FastHttpRequestIdentifierFeature
- #306
- Loading branch information
1 parent
5cbb534
commit 9ffe49f
Showing
2 changed files
with
46 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
44 changes: 44 additions & 0 deletions
44
test/Microsoft.AspNet.Hosting.Tests/Internal/FastHttpRequestIdentifierFeatureTests.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,44 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.AspNet.Hosting.Internal; | ||
using Xunit; | ||
|
||
namespace Microsoft.AspNet.Hosting.Tests.Internal | ||
{ | ||
public class FastHttpRequestIdentifierFeatureTests | ||
{ | ||
[Fact] | ||
public void TraceIdentifier_ReturnsId() | ||
{ | ||
var feature = new FastHttpRequestIdentifierFeature(); | ||
|
||
var id = feature.TraceIdentifier; | ||
|
||
Assert.NotNull(id); | ||
} | ||
|
||
[Fact] | ||
public void TraceIdentifier_ReturnsStableId() | ||
{ | ||
var feature = new FastHttpRequestIdentifierFeature(); | ||
|
||
var id1 = feature.TraceIdentifier; | ||
var id2 = feature.TraceIdentifier; | ||
|
||
Assert.Equal(id1, id2); | ||
} | ||
|
||
[Fact] | ||
public void TraceIdentifier_ReturnsUniqueIdForDifferentInstances() | ||
{ | ||
var feature1 = new FastHttpRequestIdentifierFeature(); | ||
var feature2 = new FastHttpRequestIdentifierFeature(); | ||
|
||
var id1 = feature1.TraceIdentifier; | ||
var id2 = feature2.TraceIdentifier; | ||
|
||
Assert.NotEqual(id1, id2); | ||
} | ||
} | ||
} |