Exemplo n.º 1
0
        private async Task _SignalRHelper_HubReceiverContainer_Gets_From_Server()
        {
            var hc = new HubConnectionBuilder()
                     .WithUrl(ProxyTestHostHolder._mainHubString).Build();
            await hc.StartAsync();

            var client = HubProxyBuilder.CreateProxy <IBar>(hc);
            var hubRec = new HubReceiverContainer <IFoo>(hc, new FooImpl());
            await client.StringType("hello");

            SpinWait.SpinUntil(() => false, TimeSpan.FromSeconds(2));
            Assert.True(FooImpl.callCounter["hello"] > 0);
            GC.KeepAlive(hubRec);
            hubRec.Dispose();
        }
Exemplo n.º 2
0
        private async Task _multiParam()
        {
            var hc = new HubConnectionBuilder()
                     .WithUrl(ProxyTestHostHolder._mainHubString).Build();
            await hc.StartAsync();

            var client  = HubProxyBuilder.CreateProxy <IBar>(hc);
            var hubRec  = new HubReceiverContainer <IFoo>(hc, new FooImpl());
            var theGuid = Guid.NewGuid();
            await client.MultiParam("multi", theGuid);

            SpinWait.SpinUntil(() => false, TimeSpan.FromSeconds(2));
            Assert.True(GroupHub.callCounter["multi" + theGuid] > 0);
            Assert.True(FooImpl.callCounter["multi" + theGuid] > 0);
            GC.KeepAlive(hubRec);
            hubRec.Dispose();
        }