Beispiel #1
0
        public async Task request_eth_should_return_true()
        {
            var address = TestItem.AddressA;
            var value   = 1.Ether();

            _ethRequestService.TryRequestEthAsync(address, value).Returns(FaucetResponse.RequestCompleted(null));
            var result = await _rpc.ndm_requestEth(address);

            await _ethRequestService.Received().TryRequestEthAsync(address, value);

            result.Data.Status.Should().Be(FaucetRequestStatus.RequestCompleted.ToString());
        }
        public void protocol_initialized_event_should_be_and_set_to_faucet_if_host_address_doest_match()
        {
            var          protocolHandler = Substitute.For <IProtocolHandler, INdmPeer>();
            const string host            = "127.0.0.1";
            var          node            = new Node(host, 8545);
            var          session         = new Session(8545, node, Substitute.For <IChannel>(), NullDisconnectsAnalyzer.Instance, LimboLogs.Instance);

            _ethRequestService.FaucetHost.Returns(host);
            _subprotocolFactory.Create(session).Returns(protocolHandler);
            _factory.Create(session);
            var eventArgs = new NdmProtocolInitializedEventArgs(protocolHandler);

            protocolHandler.ProtocolInitialized += Raise.EventWith(protocolHandler,
                                                                   (ProtocolInitializedEventArgs)eventArgs);
            _subprotocolFactory.Received().Create(session);
            _protocolValidator.Received().DisconnectOnInvalid(Protocol.Ndm, session, eventArgs);
            _ethRequestService.Received().UpdateFaucet(protocolHandler as INdmPeer);
        }