예제 #1
0
 public void FileStorageIsDefault()
 {
     var config = new EngineConfiguration().WithRandomLocation();
     var storage = config.CreateStore();
     Assert.IsTrue(storage is FileStore);
     Directory.Delete(config.Location.OfJournal, true);
 }
예제 #2
0
 public void AsyncJournalingYieldsAsyncWriter()
 {
     var config = new EngineConfiguration(Guid.NewGuid().ToString());
     config.AsyncronousJournaling = true;
     config.SetStoreFactory(c => new InMemoryStore(c));
     var store = config.CreateStore();
     var writer = store.CreateJournalWriter(1);
     Assert.IsTrue(writer is AsynchronousJournalWriter);
 }
        public void Setup()
        {
            _config = new EngineConfiguration().ForIsolatedTest();
            _config.PacketOptions = PacketOptions.Checksum;

            //assign unique ints to commands
            var commandTypeTags = new Dictionary <Type, int>
            {
                { typeof(AddItemCommand), 1 },
                { typeof(RemoveItemCommand), 2 }
            };

            //dynamic registration of command type (no attributes)
            var      typeModel = TypeModel.Create();
            MetaType mt        = typeModel.Add(typeof(RemoveItemCommand), false)
                                 .Add(1, "Id");

            mt.UseConstructor = false;


            ProtoBufFormatter.ConfigureJournaling(_config, commandTypeTags, typeModel);

            _store = _config.CreateStore();
        }
예제 #4
0
 public void InjectedStorageIsResolved()
 {
     var config = new EngineConfiguration()
         .WithRandomLocation();
     var expected = new FileStore(config);
     config.SetStoreFactory((c) => expected);
     var actual = config.CreateStore();
     Assert.AreSame(expected, actual);
     Directory.Delete(config.Location.OfJournal, true);
 }