-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Fix regression in SpecializedResourceDictionary
- Loading branch information
Showing
2 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/Uno.UI.Tests/Windows_UI_Xaml/Given_SpecializedResourceDictionary.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 Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using ResourceKey = Windows.UI.Xaml.SpecializedResourceDictionary.ResourceKey; | ||
|
||
namespace Uno.UI.Tests.Windows_UI_Xaml | ||
{ | ||
[TestClass] | ||
public class Given_SpecializedResourceDictionary | ||
{ | ||
[TestInitialize] | ||
public void Init() | ||
{ | ||
UnitTestsApp.App.EnsureApplication(); | ||
} | ||
|
||
[TestMethod] | ||
public void When_ResourceKey_HashCode_Equal() | ||
{ | ||
var s1 = "StringKey"; | ||
var s2 = "StringKey"; | ||
|
||
var t1 = typeof(string); | ||
var t2 = typeof(string); | ||
|
||
var k1 = new ResourceKey(s1); | ||
var k2 = new ResourceKey(s2); | ||
var k3 = new ResourceKey(t1); | ||
var k4 = new ResourceKey(t2); | ||
|
||
Assert.AreEqual(k1.HashCode, k2.HashCode); | ||
Assert.AreEqual(k3.HashCode, k4.HashCode); | ||
} | ||
|
||
[TestMethod] | ||
public void When_ResourceKey_HashCode_NotEqual() | ||
{ | ||
var s1 = "StringKey"; | ||
var s2 = "ByteKey"; | ||
|
||
var t1 = typeof(string); | ||
var t2 = typeof(byte); | ||
|
||
var k1 = new ResourceKey(s1); | ||
var k2 = new ResourceKey(s2); | ||
var k3 = new ResourceKey(t1); | ||
var k4 = new ResourceKey(t2); | ||
|
||
Assert.AreNotEqual(k1.HashCode, k2.HashCode); | ||
Assert.AreNotEqual(k3.HashCode, k4.HashCode); | ||
} | ||
} | ||
} |
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