public async Task SelectionCreateTest()
        {
            var output = new TestOutput();
            await SavedSelection.RunGetSavedSelection(AppConstants.SavedSelectionId, output);

            Assert.AreNotEqual(string.Empty, output.ReturnValueStr);
        }
        public async Task SelectionGetTest()
        {
            var output = new TestOutput();
            await SavedSelection.RunGetSavedSelection(AppConstants.SavedSelectionId, output);

            Assert.AreEqual(AppConstants.SavedSelectionId.ToString(), output.ReturnValueStr);
        }
        public async Task SelectionUpdateTest()
        {
            // get the selection pre-update, store original LastUpdated value
            var api          = new Mandoline.Api.Client.ApiClient(AppConstants.BaseURL, AppConstants.ApiToken);
            var oldSelection = await api.GetSavedSelection(AppConstants.SavedSelectionId);

            var preTestUpdateTime = oldSelection.Result.LastUpdate;

            // update saved selection with new name only
            var output = new TestOutput();
            await SavedSelection.RunUpdateSavedSelection(output);

            // get saved selection again, storing new LastUpdated value
            var newSelection = await api.GetSavedSelection(AppConstants.SavedSelectionId);

            var postTestUpdateTime = newSelection.Result.LastUpdate;

            // new LastUpdated should be greater than old
            Assert.IsTrue(postTestUpdateTime > preTestUpdateTime);
        }
Exemple #4
0
 public async Task UpdateSelection()
 {
     await SavedSelection.RunUpdateSavedSelection(this.output);
 }
Exemple #5
0
 public async Task GetSelection()
 {
     await SavedSelection.RunGetSavedSelection(AppConstants.SavedSelectionId, this.output);
 }
        private async void ButtonSubmit_Click(object sender, EventArgs e)
        {
            // check the case that
            if (this.comboBox1.Text != "Login" &&
                (AppConstants.ApiToken == "INVALID_KEY" || AppConstants.ApiToken == string.Empty))
            {
                this.label1.Text    = "Must be logged in to run this function...";
                this.label1.Visible = true;
                return;
            }

            this.label1.Text    = "Running " + this.comboBox1.Text + "...";
            this.label1.Visible = true;

            switch (this.comboBox1.Text)
            {
            case "DownloadShaped":
                await DownloadShaped.RunDownloadShapedAsync(this.output);

                break;

            case "DownloadShapedStream":
                await DownloadShaped.RunDownloadShapedStreamAsync(this.output);

                break;

            case "DownloadFile":
                await Download.RunDownloadFileAsync(this.output);

                break;

            case "GetVariables":
                await Info.RunGetVariablesAsync(this.output);

                break;

            case "GetRegions":
                await Info.RunGetRegionsAsync(this.output);

                break;

            case "RequestDownload":
                await Download.RunRequestDownloadAsync(this.output);

                break;

            case "GetSavedSelection":
                await SavedSelection.RunGetSavedSelection(AppConstants.SavedSelectionId, this.output);

                break;

            case "UpdateSavedSelection":
                await SavedSelection.RunUpdateSavedSelection(this.output);

                break;

            case "CreateSavedSelection":
                await SavedSelection.RunCreateSavedSelection(this.output);

                break;

            case "GetAllUsers":
                await Core.User.RunGetAllUsersAsync(this.output);

                break;

            case "Login":
                await Core.User.RunLoginAsync(this.output, this.textBox0.Text, this.textBox1.Text);

                break;

            case "GetUser":
                await Core.User.RunGetUserAsync(this.output);

                break;

            case "GetDatabanks":
                await Info.RunGetDatabanksAsync(this.output);

                break;

            case "Download":
                await Download.RunDownloadAsync(this.output);

                break;

            default:
                this.label1.Text = "Invalid selection";
                break;
            }
        }