You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using JsonSerializerAdapter and default settings, the resulting generated journal file cannot be read.
The test below fails with;
System.NotSupportedException : Specified method is not supported.
at Memstate.JsonNet.SurrogateConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)in C:\src\git-alan-public\memstate-fork-alan\Memstate.JsonNet\SurrogateConverter.cs:line 43
Steps to reproduce the error, run this test
[Test]publicasync Task Json_file_created_should_be_able_to_be_deserialized(){
Print("Given a journal file");varsettings=new MemstateSettings {StreamName="json-example2"};
settings.Serializers.Register("a-unique-key",_ =>new JsonSerializerAdapter(settings));
settings.Serializer ="a-unique-key";varmodel1=awaitnew EngineBuilder(settings).BuildAsync<LedgerDB>();await model1.ExecuteAsync(new InitAccount(accountNumber:1, openingBalance:100.11M, currency:'£'));await model1.ExecuteAsync(new InitAccount(accountNumber:2, openingBalance:200.22M, currency:'£'));await model1.ExecuteAsync(new Transfer(fromAccount:1, toAccount:2, amount:0.01M, currency:'£'));varaccounts1=await model1.ExecuteAsync(new GetAccounts());await model1.DisposeAsync();
Assert.True(File.Exists("json-example2.journal"));
Print("When I create an new LedgerDB that will read the recently created ledger file");varmodel2=awaitnew EngineBuilder(settings).BuildAsync<LedgerDB>();
Print("then the journal entries should have been read in");varaccounts2=await model2.ExecuteAsync(new GetAccounts());
Assert.AreEqual(2, accounts2.Count);
Print("And the in memory object database should be back to the latest state");
CollectionAssert.AreEqual(accounts1, accounts2);}
You can use any Engine<T> with any commands. The important point is the serializer settings.
The text was updated successfully, but these errors were encountered:
goblinfactory
changed the title
Json serializer does not create a journal file that can be read
Json serializer does not create a journal file that can be read (NotSupportedException)
Mar 6, 2018
When using
JsonSerializerAdapter
and default settings, the resulting generated journal file cannot be read.The test below fails with;
Steps to reproduce the error, run this test
You can use any
Engine<T>
with any commands. The important point is the serializer settings.The text was updated successfully, but these errors were encountered: