Ejemplo n.º 1
0
        public void Subscribe_ShouldSuccessfullySubscribe()
        {
            var subscriptionRequest = new SubscriptionRequest("callbackUri", "topic", "12345", _oneDayTimeSpan, "secret",
                                                              "verifyToken");
            var actualRequestBody = "";
            _mockHttpClient.Setup(x => x.Post(It.IsAny<string>()))
                .Callback(delegate(string requestData) { actualRequestBody = requestData; });

            var subscriberClient = new SubscriberClient(_mockHttpClient.Object, _mockSubscriptionRepository.Object);
            subscriberClient.MakeRequest(subscriptionRequest);

            Assert.AreEqual(subscriptionRequest.BuildRequestParameterString(), actualRequestBody);
        }
Ejemplo n.º 2
0
        public void Subscribe_ShouldPersistSubsciptionRequest()
        {
            var addedCount = 0;
            var subscriptionRequest = new SubscriptionRequest("callbackUri", "topic", "12345", _oneDayTimeSpan, "secret",
                                                              "verifyToken");
            _mockSubscriptionRepository.Setup(x => x.Add(It.IsAny<SubscriptionRequestBase>()))
                .Callback(delegate(SubscriptionRequestBase subscriptionRequestBase) { addedCount += 1; }
                );

            var subscriberClient = new SubscriberClient(_mockHttpClient.Object, _mockSubscriptionRepository.Object);
            subscriberClient.MakeRequest(subscriptionRequest);

            Assert.AreEqual(1, addedCount);
        }
Ejemplo n.º 3
0
 public void Ctor_ShouldBeConstructedWithUrl()
 {
     const string anyUrl = "http://localhost";
     var subscriberClient = new SubscriberClient(anyUrl);
 }