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); }
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"); }
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"); }