Example #1
0
        public void AgendaUpdate_ValidIdentification_DoesNotFail()
        {
            // Arrange
            var model = new AgendaPatchModel
            {
                Contact = new AgendaContactPatchModel
                {
                    IdentificationNumber      = string.Empty,
                    HasNoIdentificationNumber = true
                }
            };

            // Act
            var hasIdentificationData = _accountClient.Agendas.Update(model).AssertResult().Contact;

            // Assert
            Assert.That(hasIdentificationData.IdentificationNumber, Is.Empty);
            Assert.That(hasIdentificationData.HasNoIdentificationNumber, Is.True);

            var identificationNumber = "25568736";

            model.Contact.IdentificationNumber      = identificationNumber;
            model.Contact.HasNoIdentificationNumber = false;

            // Act
            var data = _accountClient.Agendas.Update(model).AssertResult();

            // Assert
            Assert.NotNull(data);
            Assert.NotNull(data.Contact);
            Assert.That(data.Contact.IdentificationNumber, Is.EqualTo(identificationNumber));
            Assert.That(data.Contact.HasNoIdentificationNumber, Is.False);
        }
Example #2
0
        public void AgendaUpdate_DoesNotFail()
        {
            // Arrange
            var model = new AgendaPatchModel();

            // Act
            var data = _accountClient.Agendas.Update(model).AssertResult();

            // Assert
            Assert.NotNull(data);
            Assert.NotNull(data.AutomaticPairPaymentsSettings);
            Assert.True(data.BankAccounts.Any());
            Assert.True(data.CashRegisters.Any());
            Assert.NotNull(data.Contact);
            Assert.NotNull(data.PurchaseSettings);
            Assert.NotNull(data.SalesSettings);
            Assert.NotNull(data.SendReminderSettings);
            Assert.NotNull(data.Subscription);
        }
Example #3
0
        public void AgendaUpdate_InValidIdentification_UpdateFailed()
        {
            // Arrange
            var model = new AgendaPatchModel
            {
                Contact = new AgendaContactPatchModel
                {
                    IdentificationNumber      = "invalid",
                    HasNoIdentificationNumber = false
                }
            };

            // Act
            var result = _accountClient.Agendas.Update(model);

            // Assert
            Assert.False(result.IsSuccess);
            Assert.AreEqual(DokladErrorCode.InvalidIdentificationNumber, result.ErrorCode);
            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode);
        }
Example #4
0
 /// <inheritdoc />
 public ApiResult <AgendaGetModel> Update(AgendaPatchModel model)
 {
     return(_client.Patch <AgendaPatchModel, AgendaGetModel>(CurrentAgendaUrl, model));
 }
Example #5
0
 /// <inheritdoc />
 public Task <ApiResult <AgendaGetModel> > UpdateAsync(AgendaPatchModel model, CancellationToken cancellationToken = default)
 {
     return(_client.PatchAsync <AgendaPatchModel, AgendaGetModel>(CurrentAgendaUrl, model, cancellationToken));
 }