public void Init() { _hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256")); _cycleEventProvider = new TestCycleEventProvider(); _deltaBuilder = Substitute.For <IDeltaBuilder>(); _deltaVoter = Substitute.For <IDeltaVoter>(); _deltaElector = Substitute.For <IDeltaElector>(); _deltaCache = Substitute.For <IDeltaCache>(); _deltaHub = Substitute.For <IDeltaHub>(); var deltaHashProvider = Substitute.For <IDeltaHashProvider>(); var logger = Substitute.For <ILogger>(); _syncState = new SyncState { IsSynchronized = true, IsRunning = true }; _ledger = Substitute.For <ILedger>(); _consensus = new Consensus( _deltaBuilder, _deltaVoter, _deltaElector, _deltaCache, _deltaHub, _cycleEventProvider, deltaHashProvider, logger); _consensus.StartProducing(); }
public ConsensusTests() { var hashingAlgorithm = HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"); _hashProvider = new HashProvider(hashingAlgorithm); _cycleEventProvider = new TestCycleEventProvider(); _deltaBuilder = Substitute.For <IDeltaBuilder>(); _deltaVoter = Substitute.For <IDeltaVoter>(); _deltaElector = Substitute.For <IDeltaElector>(); _deltaCache = Substitute.For <IDeltaCache>(); _deltaHub = Substitute.For <IDeltaHub>(); var deltaHashProvider = Substitute.For <IDeltaHashProvider>(); var logger = Substitute.For <ILogger>(); _consensus = new Consensus( _deltaBuilder, _deltaVoter, _deltaElector, _deltaCache, _deltaHub, _cycleEventProvider, deltaHashProvider, _hashProvider, logger); _consensus.StartProducing(); }
public Consensus(IDeltaBuilder deltaBuilder, IDeltaVoter deltaVoter, IDeltaElector deltaElector, IDeltaCache deltaCache, IDeltaHub deltaHub, ICycleEventsProvider cycleEventsProvider, IDeltaHashProvider deltaHashProvider, ILogger logger) { _deltaVoter = deltaVoter; _deltaElector = deltaElector; _cycleEventsProvider = cycleEventsProvider; _deltaHashProvider = deltaHashProvider; _deltaBuilder = deltaBuilder; _deltaHub = deltaHub; _deltaCache = deltaCache; _logger = logger; logger.Information("Consensus repository initialised."); }