Ejemplo n.º 1
0
 public ResultSrv <SubscriptionSrv> ConfirmSubscription()
 {
     try
     {
         var output = new ResultSrv <SubscriptionSrv>();
         var confirmSubscriptionVo = ConfirmSubscriptionVo.ConcreteBuilder
                                     .SetServiceCallParameters(internalServiceCallVo)
                                     .SetCode("0")
                                     .SetSubscriptionId(0)
                                     .Build();
         SubscriptionService.ConfirmSubscription(confirmSubscriptionVo, response => Listener.GetResult(response, out output));
         return(output);
     }
     catch (PodException podException)
     {
         Console.WriteLine(
             $"-- {podException.Code}-an error has occured : {Environment.NewLine}{podException.Message}");
         throw;
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception.Message);
         throw;
     }
 }
Ejemplo n.º 2
0
        public async Task AssertConfirmSubscriptionCallsRepoAsync()
        {
            //Given
            var subscription = new Subscription {
                Id                    = Guid.NewGuid().ToString(),
                AccountID             = subAccountId,
                TopicID               = subTopicId,
                ConfirmationToken     = subConfirmationId,
                SubscriptionConfirmed = false
            };
            var ar = new ActionResult <Subscription> {
                resposeObject = subscription, statusCode = HttpStatusCode.OK
            };

            _mockSubRepo.Setup(m => m.GetSubscriptionByConfirmation(subConfirmationId, subAccountId, string.Empty))
            .Returns(ar);

            //When
            var result = await _subscriptionService.ConfirmSubscription(subConfirmationId, subAccountId, string.Empty);

            //Then
            _mockSubRepo.Verify(m => m.GetSubscriptionByConfirmation(subConfirmationId, subAccountId, string.Empty));
            _mockSubRepo.Verify(m => m.UpdateSubscription(It.IsAny <Subscription>(), string.Empty));
        }
        public void ConfirmSubscription_AllParameters()
        {
            var internalServiceCallVo = InternalServiceCallVo.ConcreteBuilder
                                        .SetToken("0469eba2ddf84cb49eff254fe353638d")
                                        .Build();

            var output = new ResultSrv <SubscriptionSrv>();
            var confirmSubscriptionVo = ConfirmSubscriptionVo.ConcreteBuilder
                                        .SetServiceCallParameters(internalServiceCallVo)
                                        .SetCode("0")
                                        .SetSubscriptionId(0)
                                        .Build();

            SubscriptionService.ConfirmSubscription(confirmSubscriptionVo,
                                                    response => Listener.GetResult(response, out output));
            Assert.False(output.HasError);
        }