コード例 #1
0
            public override void NewServer(TransportMessage m, string uri, Resources resources)
            {
                ValueFactory    vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
                MailboxManager  x  = new PlainMailboxManager(m, uri, resources);
                DeliveryService d  = new DefaultDeliveryService(x, uri, resources);
                Pool            qp = (Pool)resources[QUEUED_POOL];
                Pool            fp = (Pool)resources[FREE_POOL];

                _implFactory.NewMyCuaeServer(d, qp, fp, (MyValueFactoryCuae)vf);
                d.TransportControl(TransportConsts.START, null);
            }
コード例 #2
0
        public async Task DeliverMessage_ServerError()
        {
            // Setup
            var testUri  = new Uri("https://server/path");
            var testBody = "Test Value";

            httpHandler.SetResponse(new HttpResponseMessage(HttpStatusCode.InsufficientStorage));

            // Test
            var service = new DefaultDeliveryService(logger, httpClient);
            var result  = await service.DeliverMessage(testUri, testBody);

            // Assert
            Assert.AreEqual(false, result.SentSuccessfully, "result reported failure");
            Assert.AreEqual(507, result.StatusCode, "result reported wrong status");
        }
コード例 #3
0
        public async Task DeliverMessage_Successful()
        {
            // Setup
            var testUri  = new Uri("https://server/path");
            var testBody = "Test Value";

            httpHandler.SetResponse(new HttpResponseMessage(HttpStatusCode.NoContent));

            // Test
            var service = new DefaultDeliveryService(logger, httpClient);
            var result  = await service.DeliverMessage(testUri, testBody);

            // Assert
            Assert.AreEqual(true, result.SentSuccessfully, "result reported failure");
            Assert.AreEqual(204, result.StatusCode, "result reported wrong status");
            Assert.AreEqual("Message Delivered", result.Message, "incorrect message");
        }