-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the PropertyFetcher case insensitive (#49)
- Loading branch information
1 parent
5d9c340
commit 7f292f6
Showing
2 changed files
with
55 additions
and
1 deletion.
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
52 changes: 52 additions & 0 deletions
52
test/OpenTracing.Contrib.NetCore.Tests/Internal/PropertyFetcherTest.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,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using OpenTracing.Contrib.NetCore.Internal; | ||
using Xunit; | ||
|
||
namespace OpenTracing.Contrib.NetCore.Tests.Internal | ||
{ | ||
public class PropertyFetcherTest | ||
{ | ||
public class TestClass | ||
{ | ||
public string TestProperty { get; set; } | ||
} | ||
|
||
[Fact] | ||
public void Fetch_NameNotFound_NullReturned() | ||
{ | ||
var obj = new TestClass { TestProperty = "TestValue" }; | ||
|
||
var sut = new PropertyFetcher("DifferentProperty"); | ||
|
||
var result = sut.Fetch(obj); | ||
|
||
Assert.Null(result); | ||
} | ||
|
||
[Fact] | ||
public void Fetch_NameFound_ValueReturned() | ||
{ | ||
var obj = new TestClass { TestProperty = "TestValue" }; | ||
|
||
var sut = new PropertyFetcher("TestProperty"); | ||
|
||
var result = sut.Fetch(obj); | ||
|
||
Assert.Equal("TestValue", result); | ||
} | ||
|
||
[Fact] | ||
public void Fetch_NameFoundDifferentCasing_ValueReturned() | ||
{ | ||
var obj = new TestClass { TestProperty = "TestValue" }; | ||
|
||
var sut = new PropertyFetcher("testproperty"); | ||
|
||
var result = sut.Fetch(obj); | ||
|
||
Assert.Equal("TestValue", result); | ||
} | ||
} | ||
} |