public void Post_SuccessfullyCreated()
        {
            // Arrange
            _proformaInvoicePostModel                   = _proformaInvoiceClient.Default().AssertResult();
            _proformaInvoicePostModel.PartnerId         = PartnerId;
            _proformaInvoicePostModel.DeliveryAddressId = DeliveryAddressId1;
            _proformaInvoicePostModel.Description       = "Invoice";
            _proformaInvoicePostModel.DateOfPayment     = DateTime.UtcNow.SetKindUtc();
            _proformaInvoicePostModel.IsEet             = false;
            _proformaInvoicePostModel.Items.Clear();
            _proformaInvoicePostModel.Items.Add(new ProformaInvoiceItemPostModel
            {
                Name      = "Test",
                UnitPrice = 100,
                Amount    = 1
            });

            // Act
            var data = _proformaInvoiceClient.Post(_proformaInvoicePostModel).AssertResult();

            _proformaInvoiceId = data.Id;

            // Assert
            Assert.Greater(data.Id, 0);
            Assert.AreEqual(_proformaInvoicePostModel.DateOfIssue, data.DateOfIssue);
            Assert.AreEqual(PartnerId, data.PartnerId);
            Assert.AreEqual(_proformaInvoicePostModel.DateOfPayment.GetValueOrDefault().Date, data.DateOfPayment);
            Assert.Greater(data.Items.Count, 0);
            AssertDeliveryAddress(data.DeliveryAddress, DeliveryAddressId1);
        }
Exemple #2
0
        public async Task PostAsync_SuccessfullyCreated()
        {
            // Arrange
            _proformaInvoicePostModelAsync               = _proformaInvoiceClient.Default().AssertResult();
            _proformaInvoicePostModelAsync.PartnerId     = PartnerId;
            _proformaInvoicePostModelAsync.Description   = "Invoice";
            _proformaInvoicePostModelAsync.DateOfPayment = DateTime.UtcNow.SetKindUtc();
            _proformaInvoicePostModelAsync.IsEet         = false;
            _proformaInvoicePostModelAsync.Items.Clear();
            _proformaInvoicePostModelAsync.Items.Add(new ProformaInvoiceItemPostModel
            {
                Name      = "Test",
                UnitPrice = 100,
                Amount    = 1
            });

            // Act
            var data = (await _proformaInvoiceClient.PostAsync(_proformaInvoicePostModelAsync)).AssertResult();

            _proformaInvoiceIdAsync = data.Id;

            // Assert
            Assert.Greater(data.Id, 0);
            Assert.AreEqual(_proformaInvoicePostModelAsync.DateOfIssue, data.DateOfIssue);
            Assert.AreEqual(PartnerId, data.PartnerId);
            Assert.Greater(data.Items.Count, 0);
        }
 private void AssertProformaInvoice(ProformaInvoicePostModel proformaInvoice, SalesOrderGetModel salesOrder)
 {
     Assert.AreEqual(SalesOrderId, proformaInvoice.SalesOrderId);
     Assert.AreEqual(salesOrder.Description, proformaInvoice.Description);
     Assert.AreEqual(salesOrder.CurrencyId, proformaInvoice.CurrencyId);
     Assert.AreEqual(salesOrder.ExchangeRate, proformaInvoice.ExchangeRate);
     Assert.AreEqual(salesOrder.ExchangeRateAmount, proformaInvoice.ExchangeRateAmount);
     Assert.AreEqual(salesOrder.PartnerId, proformaInvoice.PartnerId);
     Assert.AreEqual(salesOrder.PaymentOptionId, proformaInvoice.PaymentOptionId);
     Assert.AreEqual(salesOrder.OrderNumber, proformaInvoice.OrderNumber);
     Assert.AreEqual(salesOrder.MyAddress.AccountNumber, proformaInvoice.AccountNumber);
     Assert.AreEqual(salesOrder.MyAddress.Iban, proformaInvoice.Iban);
     Assert.AreEqual(salesOrder.MyAddress.Swift, proformaInvoice.Swift);
 }
 /// <inheritdoc />
 public ApiResult <ProformaInvoiceGetModel> Post(ProformaInvoicePostModel model)
 {
     return(Post <ProformaInvoicePostModel, ProformaInvoiceGetModel>(model));
 }
 /// <inheritdoc />
 public Task <ApiResult <ProformaInvoiceGetModel> > PostAsync(ProformaInvoicePostModel model, CancellationToken cancellationToken = default)
 {
     return(PostAsync <ProformaInvoicePostModel, ProformaInvoiceGetModel>(model, cancellationToken));
 }