Esempio n. 1
0
    public void TestListSubscriptions()
    {
        string topicId        = "testTopicForListingSubscriptions" + _pubsubFixture.RandomName();
        string subscriptionId = "testSubscriptionForListingSubscriptions" + _pubsubFixture.RandomName();

        _pubsubFixture.CreateTopic(topicId);
        _pubsubFixture.CreateSubscription(topicId, subscriptionId);

        var subscriptions = _listSubscriptionsSample.ListSubscriptions(_pubsubFixture.ProjectId);

        Assert.Contains(subscriptions.Select(s => s.SubscriptionName.SubscriptionId), c => c.Contains(subscriptionId));
    }
    public void TestUpdatePushConfiguration()
    {
        string randomName     = _pubsubFixture.RandomName();
        string topicId        = $"testTopicForUpdatePushConfiguration{randomName}";
        string subscriptionId = $"testSubscriptionForUpdatePushConfiguration{randomName}";

        _pubsubFixture.CreateTopic(topicId);
        _createPushSubscriptionSample.CreatePushSubscription(_pubsubFixture.ProjectId, topicId, subscriptionId, "https://my-test-project.appspot.com/push");
        _pubsubFixture.TempSubscriptionIds.Add(subscriptionId);

        var updatedPushEndpoint = "https://my-test-project.appspot.update.com/push";

        _updatePushConfigurationSample.UpdatePushConfiguration(_pubsubFixture.ProjectId, subscriptionId, updatedPushEndpoint);

        var subscriptions = _listSubscriptionsSample.ListSubscriptions(_pubsubFixture.ProjectId);

        Assert.Contains(subscriptions, s => s.PushConfig.PushEndpoint == updatedPushEndpoint && s.SubscriptionName.SubscriptionId == subscriptionId);
    }