-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from SteamDatabase/utf8
Serialize text kv without utf8 bom
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
ValveKeyValue/ValveKeyValue.Test/KVSerializerUtf8NoBomTestCase.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,35 @@ | ||
using System; | ||
using System.IO; | ||
using NUnit.Framework; | ||
|
||
namespace ValveKeyValue.Test | ||
{ | ||
class KVSerializerUtf8NoBomTestCase | ||
{ | ||
[TestCase] | ||
public void TextSerializerDoesNotProduceUtf8Preamble() | ||
{ | ||
var dataObject = new DataObject | ||
{ | ||
Name = "First" | ||
}; | ||
|
||
byte[] output; | ||
using (var ms = new MemoryStream()) | ||
{ | ||
KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Serialize(ms, dataObject, "test"); | ||
|
||
ms.Seek(0, SeekOrigin.Begin); | ||
|
||
output = ms.ToArray(); | ||
} | ||
|
||
Assert.AreEqual((byte)'"', output[0]); | ||
} | ||
|
||
class DataObject | ||
{ | ||
public string Name { get; set; } | ||
} | ||
} | ||
} |
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