Пример #1
0
        public void Start()
        {
            _restorer.RestoreCache();

            _archiver = new StreamArchiver(_fileSystem,
                                           "cachelog.bin",
                                           _memCache,
                                           10000);

            _memCache.Notifications.ObserveOn(Scheduler.Default).Subscribe(_archiver);

            _server.Start();

            _restListener.Start();
            _websocketServer.Start();
        }
Пример #2
0
        public void Setup()
        {
            // TODO: test the archiver without a cache
            _originalCache = new MemCache(1000);
            _mockFile      = new Mock <IFile>();

            _writeStream = new MemoryStream();
            _mockFile.Setup(s => s.Open(
                                It.IsAny <string>(),
                                It.Is <FileMode>(fm => fm == FileMode.OpenOrCreate),
                                It.Is <FileAccess>(fa => fa == FileAccess.Write))).Returns(_writeStream);

            _mockFileSystem = new Mock <IFileSystem>();
            _mockFileSystem.SetupGet(fs => fs.File).Returns(_mockFile.Object);


            _streamArchiver = new StreamArchiver(_mockFileSystem.Object, "path", _originalCache, 1000);
            _originalCache.Notifications.Subscribe(_streamArchiver);
        }