public void UpdatePriceListTest() { var description = $"{DateTime.Now}"; var request = new FortnoxApiRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); var voucherSeries = new VoucherSeries { Code = "X", Description = description }; var updatedVoucherSeries = VoucherSeriesService.UpdateVoucherSeriesAsync(request, voucherSeries).GetAwaiter().GetResult(); Assert.AreEqual(description, updatedVoucherSeries.Description); }
public void Test_VoucherSeries_CRUD() { #region Arrange //Add code to create required resources #endregion Arrange IVoucherSeriesConnector connector = new VoucherSeriesConnector(); #region CREATE var newVoucherSeries = new VoucherSeries() { Code = "TST", Description = "TestVoucherSeries", }; var createdVoucherSeries = connector.Create(newVoucherSeries) ?? connector.Update(newVoucherSeries); //if already exists, update it instead MyAssert.HasNoError(connector); Assert.AreEqual("TestVoucherSeries", createdVoucherSeries.Description); #endregion CREATE #region UPDATE createdVoucherSeries.Description = "UpdatedTestVoucherSeries"; var updatedVoucherSeries = connector.Update(createdVoucherSeries); MyAssert.HasNoError(connector); Assert.AreEqual("UpdatedTestVoucherSeries", updatedVoucherSeries.Description); #endregion UPDATE #region READ / GET var retrievedVoucherSeries = connector.Get(createdVoucherSeries.Code); MyAssert.HasNoError(connector); Assert.AreEqual("UpdatedTestVoucherSeries", retrievedVoucherSeries.Description); #endregion READ / GET #region DELETE //Not supported #endregion DELETE #region Delete arranged resources //Add code to delete temporary resources #endregion Delete arranged resources }
public async Task Test_VoucherSeries_CRUD() { #region Arrange //Add code to create required resources #endregion Arrange var connector = FortnoxClient.VoucherSeriesConnector; #region CREATE //var digits = new char[]{ '0', '1', '2', '3', '4', '5'} var newVoucherSeries = new VoucherSeries() { Code = TestUtils.RandomInt().ToString(), Description = "TestVoucherSeries", }; var createdVoucherSeries = await connector.CreateAsync(newVoucherSeries); Assert.AreEqual("TestVoucherSeries", createdVoucherSeries.Description); #endregion CREATE #region UPDATE createdVoucherSeries.Description = "UpdatedTestVoucherSeries"; var updatedVoucherSeries = await connector.UpdateAsync(createdVoucherSeries); Assert.AreEqual("UpdatedTestVoucherSeries", updatedVoucherSeries.Description); #endregion UPDATE #region READ / GET var retrievedVoucherSeries = await connector.GetAsync(createdVoucherSeries.Code); Assert.AreEqual("UpdatedTestVoucherSeries", retrievedVoucherSeries.Description); #endregion READ / GET #region DELETE //Not supported #endregion DELETE #region Delete arranged resources //Add code to delete temporary resources #endregion Delete arranged resources }
public void Test_VoucherSeries_CRUD() { #region Arrange //Add code to create required resources #endregion Arrange IVoucherSeriesConnector connector = new VoucherSeriesConnector(); #region CREATE //var digits = new char[]{ '0', '1', '2', '3', '4', '5'} var newVoucherSeries = new VoucherSeries() { Code = TestUtils.RandomInt().ToString(), Description = "TestVoucherSeries", }; var createdVoucherSeries = connector.Create(newVoucherSeries) ?? connector.Update(newVoucherSeries); //if already exists, update it instead Assert.AreEqual("TestVoucherSeries", createdVoucherSeries.Description); #endregion CREATE #region UPDATE createdVoucherSeries.Description = "UpdatedTestVoucherSeries"; var updatedVoucherSeries = connector.Update(createdVoucherSeries); Assert.AreEqual("UpdatedTestVoucherSeries", updatedVoucherSeries.Description); #endregion UPDATE #region READ / GET var retrievedVoucherSeries = connector.Get(createdVoucherSeries.Code); Assert.AreEqual("UpdatedTestVoucherSeries", retrievedVoucherSeries.Description); #endregion READ / GET #region DELETE //Not supported #endregion DELETE #region Delete arranged resources //Add code to delete temporary resources #endregion Delete arranged resources }
public async Task <VoucherSeries> UpdateAsync(VoucherSeries voucherSeries) { return(await BaseUpdate(voucherSeries, voucherSeries.Code)); }
public async Task <VoucherSeries> CreateAsync(VoucherSeries voucherSeries) { return(await BaseCreate(voucherSeries)); }
/// <summary> /// Creates a new voucherSeries /// </summary> /// <param name="voucherSeries">The voucherSeries to create</param> /// <returns>The created voucherSeries</returns> public VoucherSeries Create(VoucherSeries voucherSeries) { return(CreateAsync(voucherSeries).Result); }
/// <summary> /// Updates a voucherSeries /// </summary> /// <param name="voucherSeries">The voucherSeries to update</param> /// <returns>The updated voucherSeries</returns> public VoucherSeries Update(VoucherSeries voucherSeries) { return(UpdateAsync(voucherSeries).Result); }
/// <summary> /// Creates a new voucher series /// </summary> /// <param name="voucherseries">The voucher series to create</param> /// <returns>The created voucher series</returns> public VoucherSeries Create(VoucherSeries voucherseries) { return(BaseCreate(voucherseries)); }
/// <summary> /// Updates a vocuher series /// </summary> /// <param name="voucherSeries">The voucher series to update</param> /// <returns>The updated voucher series</returns> public VoucherSeries Update(VoucherSeries voucherSeries) { return(BaseUpdate(voucherSeries, voucherSeries.Code)); }
public static async Task <VoucherSeries> UpdateVoucherSeriesAsync(FortnoxApiRequest request, VoucherSeries voucherSeries) { var apiRequest = new FortnoxApiClientRequest <SingleResource <VoucherSeries> >(HttpMethod.Put, request.AccessToken, request.ClientSecret, $"{ApiEndpoints.VoucherSeries}/{voucherSeries.Code}/") { Data = new SingleResource <VoucherSeries> { Data = voucherSeries } }; return((await FortnoxAPIClient.CallAsync(apiRequest)).Data); }
public async Task <VoucherSeries> CreateAsync(VoucherSeries voucherSeries) { return(await BaseCreate(voucherSeries).ConfigureAwait(false)); }