Beispiel #1
0
 private void AssertModelsAreEqueal(PriceListItemGetModel getModel, PriceListItemPostModel postModel)
 {
     Assert.AreEqual(postModel.Amount, getModel.Amount);
     Assert.AreEqual(postModel.BarCode, getModel.BarCode);
     Assert.AreEqual(postModel.Code, getModel.Code);
     Assert.AreEqual(postModel.CurrencyId, getModel.CurrencyId);
     Assert.AreEqual(postModel.IsStockItem, getModel.IsStockItem);
     Assert.AreEqual(postModel.Name, getModel.Name);
     Assert.AreEqual(postModel.Price, getModel.Price);
     Assert.AreEqual(postModel.PriceType, getModel.PriceType);
     Assert.AreEqual(postModel.Unit, getModel.Unit);
     Assert.AreEqual(postModel.VatRateType, getModel.VatRateType);
     Assert.AreEqual(postModel.VatCodeId, getModel.VatCodeId);
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 /// <inheritdoc/>
 public Task <ApiResult <PriceListItemGetModel> > PostAsync(PriceListItemPostModel model, CancellationToken cancellationToken = default)
 {
     return(PostAsync <PriceListItemPostModel, PriceListItemGetModel>(model, cancellationToken));
 }