public void OneTimeTearDown() { foreach (var id in _newPriceListItems) { PriceListItemClient.Delete(id); } }
public async Task DeleteAsync_SuccessfullyDeleted() { // Act var data = (await PriceListItemClient.DeleteAsync(_newPriceListItemId, true)).AssertResult(); // Assert Assert.True(data); }
public void GetDetail_SuccessfullyGet() { // Act var data = PriceListItemClient.Detail(_newPriceListItemId).Get().AssertResult(); // Assert Assert.AreEqual(_newPriceListItemId, data.Id); AssertModelsAreEqueal(data, _priceListItemPostModel); }
public async Task GetDetailAsync_SuccessfullyGet() { // Act var data = (await PriceListItemClient.Detail(_newPriceListItemId).GetAsync()).AssertResult(); // Assert Assert.AreEqual(_newPriceListItemId, data.Id); AssertModelsAreEqueal(data, _priceListItemPostModel); }
public void Delete_SuccessfullyDeleted() { // Act var data = PriceListItemClient.Delete(_newPriceListItemId, true).AssertResult(); _newPriceListItems.Remove(_newPriceListItemId); // Assert Assert.True(data); }
public async Task UpdateAsync_SuccessfullyUpdated() { // Arrange var priceListItemPatchModel = CreatePatchModel(); // Act var data = (await PriceListItemClient.UpdateAsync(priceListItemPatchModel)).AssertResult(); _dateLastChange = data.Metadata.DateLastChange; // Assert AssertModelsAreEqueal(data, priceListItemPatchModel); }
public async Task BatchDeleteAsync_SuccessfullyDeleted() { // Arrange var idBatch = new List <int> { _newPriceListItemId }; // Act var data = (await PriceListItemClient.DeleteAsync(idBatch, true)).AssertResult(); // Assert Assert.True(data.First()); }
public void Update_SuccessfullyUpdated() { // Arrange var priceListItemPatchModel = CreatePatchModel(); // Act var data = PriceListItemClient.Update(priceListItemPatchModel).AssertResult(); _dateLastChange = data.Metadata.DateLastChange; // Assert AssertModelsAreEqueal(data, priceListItemPatchModel); }
public void GetListWithSort_ReturnsList() { // Act var data = PriceListItemClient .List() .Sort(x => x.Name.Desc()) .Get() .AssertResult(); // Assert Assert.NotNull(data); Assert.Greater(data.Items.Count(), 0); Assert.That(data.Items, Is.Ordered.By(nameof(PriceListItemListGetModel.Name)).Descending); }
public void GetListWithFilter_ReturnsList() { // Act var data = PriceListItemClient .List() .Filter(f => f.DateLastChange.IsGreaterThanOrEqual(_dateLastChange)) .Get() .AssertResult(); // Assert Assert.NotNull(data); Assert.Greater(data.Items.Count(), 0); Assert.True(data.Items.Any(i => i.Id == _newPriceListItemId)); }
public void BatchUpdate_SuccessfullyUpdated() { // Arrange var priceListItemPatchModel = CreatePatchModel(); var batch = new List <PriceListItemPatchModel> { priceListItemPatchModel }; // Act var data = PriceListItemClient.Update(batch).AssertResult(); var priceListItemGetModel = data.First(); // Assert AssertModelsAreEqueal(priceListItemGetModel, priceListItemPatchModel); }
public void BatchDelete_SuccessfullyDeleted() { // Arrange var idBatch = new List <int> { _newPriceListItemId }; // Act var data = PriceListItemClient.Delete(idBatch, true).AssertResult(); _newPriceListItems.Remove(_newPriceListItemId); // Assert Assert.True(data.First()); }
public async Task PostAsync_SuccessfullyPosted() { // Arrange _priceListItemPostModel = (await PriceListItemClient.DefaultAsync()).AssertResult(); SetPostModel(); // Act var data = (await PriceListItemClient.PostAsync(_priceListItemPostModel)).AssertResult(); _newPriceListItemId = data.Id; // Assert Assert.Greater(data.Id, 0); AssertModelsAreEqueal(data, _priceListItemPostModel); }
public void Post_SuccessfullyPosted() { // Arrange _priceListItemPostModel = PriceListItemClient.Default().AssertResult(); SetPostModel(); // Act var data = PriceListItemClient.Post(_priceListItemPostModel).AssertResult(); _newPriceListItemId = data.Id; _newPriceListItems.Add(_newPriceListItemId); // Assert Assert.Greater(data.Id, 0); AssertModelsAreEqueal(data, _priceListItemPostModel); }
public async Task BatchPostAsync_SuccessfullyPosted() { _priceListItemPostModel = (await PriceListItemClient.DefaultAsync()).AssertResult(); SetPostModel(); var batch = new List <PriceListItemPostModel> { _priceListItemPostModel }; // Act var data = (await PriceListItemClient.PostAsync(batch)).AssertResult(); var priceListItemGetModel = data.First(); _newPriceListItemId = priceListItemGetModel.Id; // Assert Assert.Greater(priceListItemGetModel.Id, 0); AssertModelsAreEqueal(priceListItemGetModel, _priceListItemPostModel); }
public void BatchPost_SuccessfullyPosted() { // Arrange _priceListItemPostModel = PriceListItemClient.Default().AssertResult(); SetPostModel(); var batch = new List <PriceListItemPostModel> { _priceListItemPostModel }; // Act var data = PriceListItemClient.Post(batch).AssertResult(); var priceListItemGetModel = data.First(); _newPriceListItemId = priceListItemGetModel.Id; _newPriceListItems.Add(_newPriceListItemId); // Assert Assert.Greater(priceListItemGetModel.Id, 0); AssertModelsAreEqueal(priceListItemGetModel, _priceListItemPostModel); }
public void Post_AsStockItemWithInitialData_SuccessfullyPosted() { // Arrange _priceListItemPostModel = PriceListItemClient.Default().AssertResult(); SetPostModel(); _priceListItemPostModel.InitialDateStockBalance = new DateTime(2020, 01, 01).SetKindUtc(); _priceListItemPostModel.InitialStockBalance = 100; // Act var data = PriceListItemClient.Post(_priceListItemPostModel).AssertResult(); _newPriceListItems.Add(data.Id); // Assert Assert.Greater(data.Id, 0); var stockMovements = StockMovementClient.List() .Filter(f => f.PriceListItemId.IsEqual(data.Id)).Get() .AssertResult(); var initialStockMovement = stockMovements.Items.FirstOrDefault(); Assert.NotNull(initialStockMovement); Assert.AreEqual(_priceListItemPostModel.InitialStockBalance, initialStockMovement.Amount); Assert.AreEqual(_priceListItemPostModel.InitialDateStockBalance, initialStockMovement.DateOfMovement); }