public async Task SubscriptionRemovedTest()
        {
            request = new DefaultHttpRequest(new DefaultHttpContext())
            {
                QueryString = QueryString.Create("endpoint", sub.EndPoint)
            };
            var response = await SubscriptionTriggerUnSubscribe.Run(request, client, log);

            Assert.IsInstanceOfType(response, typeof(OkResult));
        }
        public async Task UnSubscribeEmptyQueryTest()
        {
            request = new DefaultHttpRequest(new DefaultHttpContext())
            {
                QueryString = QueryString.Create("", "")
            };
            var response = await SubscriptionTriggerUnSubscribe.Run(request, client, log);

            Assert.IsInstanceOfType(response, typeof(BadRequestObjectResult));
            Assert.IsTrue((((BadRequestObjectResult)response).Value as string).Contains("Empty"));
        }
Example #3
0
        public void Initialize()
        {
            log = NullLoggerFactory.Instance.CreateLogger("Dummy");

            sub                     = new PushSubscriptionInformation();
            sub.EndPoint            = "https://dummy_endpoint";
            sub.ExpirationTime      = null;
            sub.Keys                = new Keys();
            sub.Keys.Authentication = "dummy_authentication";
            sub.Keys.p256dh         = "dummy_p256dh";

            Environment.SetEnvironmentVariable("DatabaseId", TestContext.Properties["DatabaseId"].ToString(), EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("CollectionId", TestContext.Properties["CollectionId"].ToString(), EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("AzureWebJobsStorage", TestContext.Properties["AzureWebJobsStorage"].ToString(), EnvironmentVariableTarget.Process);

            client = new DocumentClient(new Uri(TestContext.Properties["AccountEndpoint"].ToString()), TestContext.Properties["AccountKey"].ToString());
            notificationQueueService       = new NotificationQueueService();
            subscriptionService            = new SubscriptionService(notificationQueueService);
            subscriptionService.Client     = client;
            subscriptionTriggerUnSubscribe = new SubscriptionTriggerUnSubscribe(subscriptionService);
        }