public void AuthenticationSuccess() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground<JToken> playground = new WampCraPlayground<JToken> (formatter, new MockWampCraAuthenticaticationBuilder<JToken>()); IWampChannelFactory<JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection<JToken> connection = playground.CreateClientConnection(); IWampChannel<JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); channel.GetRpcProxy<IWampCraProcedures>(). Authenticate(formatter, "foobar", null, "secret"); string result = channel.GetRpcProxy<ISample>() .Hello("Foobar"); Assert.IsNotNullOrEmpty(result); }
public void AuthenticationFailure() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground<JToken> playground = new WampCraPlayground<JToken> (formatter, new MockWampCraAuthenticaticationBuilder<JToken>()); IWampChannelFactory<JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection<JToken> connection = playground.CreateClientConnection(); IWampChannel<JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); IWampCraProcedures proceduresProxy = channel.GetRpcProxy<IWampCraProcedures>(); WampRpcCallException callException = Assert.Throws<WampRpcCallException> (() => proceduresProxy.Authenticate(formatter, "foobar", null, "secret2")); }
public void NoAuthenticationThrowsException() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); Task <string> result = channel.GetRpcProxy <ISampleAsync>() .Hello("Foobar"); AggregateException aggregateException = result.Exception; Exception exception = aggregateException.InnerException; WampRpcCallException casted = exception as WampRpcCallException; Assert.IsNotNull(casted); }
public void AuthenticationFailure() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); IWampCraProcedures proceduresProxy = channel.GetRpcProxy <IWampCraProcedures>(); WampRpcCallException callException = Assert.Throws <WampRpcCallException> (() => proceduresProxy.Authenticate(formatter, "foobar", null, "secret2")); }
public void AuthenticationSuccess() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); channel.GetRpcProxy <IWampCraProcedures>(). Authenticate(formatter, "foobar", null, "secret"); string result = channel.GetRpcProxy <ISample>() .Hello("Foobar"); Assert.That(result, Is.Not.Null.Or.Empty); }
public void NoAuthenticationThrowsException() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground<JToken> playground = new WampCraPlayground<JToken> (formatter, new MockWampCraAuthenticaticationBuilder<JToken>()); IWampChannelFactory<JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection<JToken> connection = playground.CreateClientConnection(); IWampChannel<JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); Task<string> result = channel.GetRpcProxy<ISampleAsync>() .Hello("Foobar"); AggregateException aggregateException = result.Exception; Exception exception = aggregateException.InnerException; WampRpcCallException casted = exception as WampRpcCallException; Assert.IsNotNull(casted); }