Ejemplo n.º 1
0
        public void Allows_MegaDto_through_RabbitMqClients()
        {
            var mqFactory = new RabbitMqMessageFactory(connectionString: Config.RabbitMQConnString);

            var request = MegaDto.Create();

            using (var mqClient = mqFactory.CreateMessageProducer())
            {
                mqClient.Publish(request);
            }

            using (var mqClient = mqFactory.CreateMessageQueueClient())
            {
                var msg      = mqClient.Get <MegaDto>(QueueNames <MegaDto> .In);
                var response = msg.GetBody();

                Assert.That(request.T01.Id, Is.EqualTo(response.T01.Id));
            }
        }
Ejemplo n.º 2
0
        public void Allows_MegaDto_through_RedisMqClients()
        {
            var mqFactory = new RedisMessageFactory(new BasicRedisClientManager());

            var request = MegaDto.Create();

            using (var mqClient = mqFactory.CreateMessageProducer())
            {
                mqClient.Publish(request);
            }

            using (var mqClient = mqFactory.CreateMessageQueueClient())
            {
                var msg      = mqClient.Get <MegaDto>(QueueNames <MegaDto> .In);
                var response = msg.GetBody();

                Assert.That(request.T01.Id, Is.EqualTo(response.T01.Id));
            }
        }
Ejemplo n.º 3
0
        public void Allows_MegaDto_through_ServiceClient()
        {
            using (var appHost = new LicenseTestsAppHost(typeof(MegaDtoService)))
            {
                appHost.Init();
                appHost.Start(Config.ListeningOn);

                var client = new JsonServiceClient(Config.AbsoluteBaseUri);

                var request = MegaDto.Create();

                var response = client.Post(request);
                Assert.That(request.T01.Id, Is.EqualTo(response.T01.Id));

                Assert.Throws <LicenseException>(() =>
                                                 request.ToJson());

                response = client.Post(request);
                Assert.That(request.T01.Id, Is.EqualTo(response.T01.Id));

                Assert.Throws <LicenseException>(() =>
                                                 MegaDto.Create().ToJson());
            }
        }