Exemplo n.º 1
0
        public async Task DataShareE2E()
        {
            Account expectedAccount = new Account(new Identity(), ScenarioTestBase <DataShareE2EScenarioTests> .AccountLocation);

            Func <DataShareManagementClient, Task> action = async(client) =>
            {
                await AccountScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    expectedAccount);

                await ShareScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    ShareScenarioTests.GetShare());

                var synchronizationSetting = await SynchronizationSettingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.synchronizationSettingName,
                    SynchronizationSettingScenarioTests.GetSynchronizationSetting()) as ScheduledSynchronizationSetting;

                DataSet dataSet = await DataSetScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.dataSetName,
                    DataSetScenarioTests.GetDataSet());

                Invitation invitation = await InvitationScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.invitationName,
                    InvitationScenarioTests.GetExpectedInvitation());

                await ShareSubscriptionScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    ShareSubscriptionScenarioTests.GetShareSubscription(invitation.InvitationId, DataShareE2EScenarioTests.sourceShareLocationName));

                await TriggerScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.triggerName,
                    TriggerScenarioTests.GetTrigger(
                        synchronizationSetting.RecurrenceInterval,
                        synchronizationSetting.SynchronizationTime));

                await DataSetMappingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.dataSetMappingName,
                    DataSetMappingScenarioTests.GetDataSetMapping());

                ShareSubscriptionScenarioTests.Synchronize(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName);
            };

            Func <DataShareManagementClient, Task> finallyAction = async(client) =>
            {
                await AccountScenarioTests.Delete(
                    client,
                    this.ResourceGroupName,
                    this.AccountName);
            };

            await this.RunTest(action, finallyAction);
        }
Exemplo n.º 2
0
        public async Task DataShareE2E()
        {
            Account expectedAccount   = new Account(identity, "DataShareId", shareName, default(SystemData), "Microsoft.DataShare", ScenarioTestBase <DataShareE2EScenarioTests> .AccountLocation);
            string  subscriptionIdVal = Environment.GetEnvironmentVariable(subscriptionId);

            Func <DataShareManagementClient, Task> action = async(client) =>
            {
                await AccountScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    expectedAccount);

                await ShareScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    ShareScenarioTests.GetShare());

                var synchronizationSetting = await SynchronizationSettingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.synchronizationSettingName,
                    SynchronizationSettingScenarioTests.GetSynchronizationSetting()) as ScheduledSynchronizationSetting;

                DataSet dataSet = await DataSetScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.dataSetName,
                    DataSetScenarioTests.GetDataSet(containerName, DataSetScenarioTests.filepath, this.ResourceGroupName, ScenarioTestBase <DataShareE2EScenarioTests> .storageActName, subscriptionIdVal));

                Invitation invitation = await InvitationScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.invitationName,
                    InvitationScenarioTests.GetExpectedInvitation());

                EmailRegistration emailRegistration =
                    await EmailRegistrationScenarioTests.RegisterEmailAsync(client, locationOfDatabase);

                await EmailRegistrationScenarioTests.ActivateEmailAsync(client, locationOfDatabase, emailRegistration);

                await ShareSubscriptionScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    ShareSubscriptionScenarioTests.GetShareSubscription(invitation.InvitationId, DataShareE2EScenarioTests.sourceShareLocationName));

                await TriggerScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.triggerName,
                    TriggerScenarioTests.GetTrigger(
                        synchronizationSetting.RecurrenceInterval,
                        synchronizationSetting.SynchronizationTime));

                await DataSetMappingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.dataSetMappingName,
                    DataSetMappingScenarioTests.GetDataSetMapping(containerName, DataSetScenarioTests.dataSetId, DataSetScenarioTests.filepath, this.ResourceGroupName, storageActName, subscriptionIdVal));

                ShareSubscriptionScenarioTests.Synchronize(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName);
            };

            Func <DataShareManagementClient, Task> finallyAction = async(client) =>
            {
                await AccountScenarioTests.Delete(
                    client,
                    this.ResourceGroupName,
                    this.AccountName);
            };

            await this.RunTest(action, finallyAction);
        }