IApplication ITenantActionsSync.CreateApplication(IApplication application, Action<ApplicationCreationOptionsBuilder> creationOptionsAction)
        {
            var builder = new ApplicationCreationOptionsBuilder();
            creationOptionsAction(builder);
            var options = builder.Build();

            return this.GetInternalSyncDataStore().Create(ApplicationsPropertyName, application, options);
        }
        Task<IApplication> ITenantActions.CreateApplicationAsync(IApplication application, Action<ApplicationCreationOptionsBuilder> creationOptionsAction, CancellationToken cancellationToken)
        {
            var builder = new ApplicationCreationOptionsBuilder();
            creationOptionsAction(builder);
            var options = builder.Build();

            return this.GetInternalAsyncDataStore().CreateAsync(ApplicationsPropertyName, application, options, cancellationToken);
        }
            public async Task Create_application_request_with_default_directory()
            {
                var options = new ApplicationCreationOptionsBuilder()
                {
                    CreateDirectory = true
                }.Build();

                await this.VerifyThat(options, resultsInQueryString: "?createDirectory=true");
            }
            public async Task Create_without_directory()
            {
                var options = new ApplicationCreationOptionsBuilder()
                {
                    CreateDirectory = false
                }.Build();

                await this.VerifyThat(options, resultsInQueryString: string.Empty);
            }
        IApplication ITenantActionsSync.CreateApplication(string name, bool createDirectory)
        {
            var application = this.GetInternalAsyncDataStore().Instantiate<IApplication>();
            application.SetName(name);

            var options = new ApplicationCreationOptionsBuilder()
            {
                CreateDirectory = createDirectory
            }.Build();

            return this.AsTenantActionSyncInterface.CreateApplication(application, options);
        }
        Task<IApplication> ITenantActions.CreateApplicationAsync(string name, bool createDirectory, CancellationToken cancellationToken)
        {
            var application = this.GetInternalAsyncDataStore().Instantiate<IApplication>();
            application.SetName(name);

            var options = new ApplicationCreationOptionsBuilder()
            {
                CreateDirectory = createDirectory
            }.Build();

            return this.AsInterface.CreateApplicationAsync(application, options, cancellationToken);
        }
            public async Task Create_with_response_options()
            {
                var optionsBuilder = new ApplicationCreationOptionsBuilder();
                optionsBuilder.ResponseOptions.Expand(x => x.GetCustomData());
                var options = optionsBuilder.Build();

                await this.VerifyThat(options, resultsInQueryString: "?expand=customData");
            }
            public async Task Create_application_request_with_named_directory()
            {
                var options = new ApplicationCreationOptionsBuilder()
                {
                    CreateDirectory = true,
                    DirectoryName = "Foobar Directory"
                }.Build();

                await this.VerifyThat(options, resultsInQueryString: "?createDirectory=Foobar+Directory");
            }
            public async Task Create_with_all_options()
            {
                var optionsBuilder = new ApplicationCreationOptionsBuilder();
                optionsBuilder.CreateDirectory = true;
                optionsBuilder.DirectoryName = "Foobar Directory";
                optionsBuilder.ResponseOptions.Expand(x => x.GetAccounts(0, 10));
                var options = optionsBuilder.Build();

                await this.VerifyThat(options, resultsInQueryString: "?createDirectory=Foobar+Directory&expand=accounts(offset:0,limit:10)");
            }