Exemple #1
0
        public async Task AnnounceAsync_Success()
        {
            AnnouncementReceivedEventData received = null;

            _eventBus.Subscribe <AnnouncementReceivedEventData>(a =>
            {
                received = a;
                return(Task.CompletedTask);
            });

            var header = new PeerNewBlockAnnouncement
            {
                BlockHeight = 100,
                BlockHash   = Hash.Generate(),
                BlockTime   = DateTime.UtcNow.ToTimestamp()
            };

            await _grpcPeer.AnnounceAsync(header);

            received.ShouldNotBeNull();
            received.Announce.BlockHeight.ShouldBe(100);
        }