public FavouriteDeltaObserverTests() { var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256")); _deltaElector = Substitute.For <IDeltaElector>(); _fakeChannelContext = Substitute.For <IChannelHandlerContext>(); var logger = Substitute.For <ILogger>(); _voterId = PeerIdHelper.GetPeerId("favourite delta voter"); _producerId = PeerIdHelper.GetPeerId("candidate delta producer"); _favouriteDeltaObserver = new FavouriteDeltaObserver(_deltaElector, hashProvider, logger); _newHash = MultiBase.Decode(hashProvider.ComputeUtf8MultiHash("newHash").CreateCid()); _prevHash = MultiBase.Decode(hashProvider.ComputeUtf8MultiHash("prevHash").CreateCid()); }
public void Init() { var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256")); _deltaElector = Substitute.For <IDeltaElector>(); _fakeChannelContext = Substitute.For <IChannelHandlerContext>(); var logger = Substitute.For <ILogger>(); _voterId = PeerIdHelper.GetPeerId("favourite delta voter"); _producerId = PeerIdHelper.GetPeerId("candidate delta producer"); var peerRepository = Substitute.For <IPeerRepository>(); peerRepository.GetPeersByIpAndPublicKey(Arg.Any <ByteString>(), Arg.Any <ByteString>()).Returns(new List <Peer> { new Peer() }); _favouriteDeltaObserver = new FavouriteDeltaObserver(_deltaElector, new SyncState() { IsSynchronized = true }, peerRepository, hashProvider, logger); _newHash = MultiBase.Decode(hashProvider.ComputeUtf8MultiHash("newHash").ToCid()); _prevHash = MultiBase.Decode(hashProvider.ComputeUtf8MultiHash("prevHash").ToCid()); }