public void Can_load_from_type() { var model = (ImmutableModel) _store.LoadModel(typeof (ImmutableModel)); var engine = new Engine<ImmutableModel>(model, _store, _config); engine.Execute(new AppendNumberCommand(53)); engine.Execute(new AppendNumberCommand(42)); engine.Close(); _store = new InMemoryStore(_config); _store.Init(); model = (ImmutableModel) _store.LoadModel(typeof (ImmutableModel)); //make sure state is valid after restore Assert.AreEqual(53 + 42, model.Numbers().Sum()); var ids = _store.GetJournalEntries().Select(je => (int) je.Id).ToArray(); Assert.AreEqual(Enumerable.Range(1,2),ids); }
public void MyTestInitialize() { Directory.CreateDirectory(_path); _config = EngineConfiguration.Create(); _config.Location.OfJournal = _path; _config.MaxEntriesPerJournalSegment = 10; _store = new FileStore(_config); _store.Init(); var writer = _store.CreateJournalWriter(0); for (ulong i = 0; i < 30; i++) { writer.Write(new JournalEntry<Command>(i + 1, new TestCommandWithoutResult())); } writer.Close(); }
public void Init() { _config = EngineConfiguration.Create().ForIsolatedTest().ForImmutability(); _store = new InMemoryStore(_config); _store.Init(); }