Skip to content

Commit

Permalink
Create Test for Issue akkadotnet#183
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Oct 28, 2020
1 parent 228f1f1 commit 9c725c0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Hyperion.Tests/Bugs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
#endregion

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
Expand Down Expand Up @@ -246,5 +248,26 @@ public Recover(SnapshotSelectionCriteria fromSnapshot, long toSequenceNr = long.
/// </summary>
public long ReplayMax { get; private set; }
}

class Temp
{
public object[] SubArray { get; set; }
public string aa { get; set; }
public Dictionary<string,string> dc { get; set; }
}

[Fact]
public void WritesManifestEvenIfKnown1()
{
var stream = new MemoryStream();
var msg = new Temp() { aa = "huhu", dc = new Dictionary<string, string>() { { "a", "b" } }, SubArray = new object[] { 1, (byte)2, new object[] { 3 } } };
var serializer = new Serializer(new SerializerOptions(knownTypes: new[] { typeof(DictionaryEntry), typeof(Dictionary<string, string>), typeof(Temp), typeof(object[]), }));
serializer.Serialize(msg, stream);
stream.Position = 0;
var a = stream.ToArray();
var text = string.Join("", a.Select(x => ((char)x).ToString()));
var res = serializer.Deserialize(stream);
Assert.DoesNotContain("System.Collections.Generic.Dictionary", text);
}
}
}

0 comments on commit 9c725c0

Please sign in to comment.