-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Frozen Collections (NET80) (#17)
* Add Frozen Collections (NET80) * remove editorconfig * unify code
- Loading branch information
Showing
11 changed files
with
149 additions
and
22 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#if NET8_0_OR_GREATER | ||
|
||
using System.Collections.Frozen; | ||
using System.Collections.Generic; | ||
using VarDump; | ||
using Xunit; | ||
|
||
namespace UnitTests | ||
{ | ||
public class FrozenCollectionsNet8Spec | ||
{ | ||
|
||
[Fact] | ||
public void DumpFrozenSetCsharp() | ||
{ | ||
FrozenSet<int> frozenSet = new[] { 1 }.ToFrozenSet(); | ||
|
||
var dumper = new CSharpDumper(); | ||
|
||
var result = dumper.Dump(frozenSet); | ||
|
||
Assert.Equal(""" | ||
var smallValueTypeComparableFrozenSetOfInt = new int[] | ||
{ | ||
1 | ||
}.ToFrozenSet(); | ||
""", result); | ||
} | ||
|
||
[Fact] | ||
public void DumpFrozenSetVb() | ||
{ | ||
FrozenSet<int> frozenSet = new[] { 1 }.ToFrozenSet(); | ||
|
||
var dumper = new VisualBasicDumper(); | ||
|
||
var result = dumper.Dump(frozenSet); | ||
|
||
Assert.Equal(""" | ||
Dim smallValueTypeComparableFrozenSetOfInteger = New Integer(){ | ||
1 | ||
}.ToFrozenSet() | ||
""", result); | ||
} | ||
|
||
[Fact] | ||
public void DumpFrozenDictionaryCsharp() | ||
{ | ||
var frozenDictionary = new Dictionary<string, string> | ||
{ | ||
{ "Steeve", "Test reference" } | ||
}.ToFrozenDictionary(); | ||
|
||
var dumper = new CSharpDumper(); | ||
|
||
var result = dumper.Dump(frozenDictionary); | ||
|
||
Assert.Equal(""" | ||
var lengthBucketsFrozenDictionaryOfString = new Dictionary<string, string> | ||
{ | ||
{ | ||
"Steeve", | ||
"Test reference" | ||
} | ||
}.ToFrozenDictionary(); | ||
""", result); | ||
} | ||
|
||
[Fact] | ||
public void DumpFrozenDictionaryVb() | ||
{ | ||
var frozenDictionary = new Dictionary<string, string> | ||
{ | ||
{ "Steeve", "Test reference" } | ||
}.ToFrozenDictionary(); | ||
|
||
var dumper = new VisualBasicDumper(); | ||
|
||
var result = dumper.Dump(frozenDictionary); | ||
|
||
Assert.Equal(""" | ||
Dim lengthBucketsFrozenDictionaryOfString = New Dictionary(Of String, String) From { | ||
{ | ||
"Steeve", | ||
"Test reference" | ||
} | ||
}.ToFrozenDictionary() | ||
""", result); | ||
} | ||
} | ||
} | ||
|
||
#endif |
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