public static void Initialize(TestContext context) { SelectionDto sampleSelect = AppConstants.SampleSelection.GetInstance(); var api = new Mandoline.Api.Client.ApiClient(AppConstants.BaseURL, AppConstants.ApiToken); var newSelection = api.CreateSavedSelectionAsync( sampleSelect, new System.Threading.CancellationTokenSource(TimeSpan.FromMinutes(5)).Token).Result; AppConstants.SavedSelectionId = newSelection.Result.Id; }
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); }