public void HasNotification_ShouldReturnFalseIfDoNotHaveNotifications()
        {
            // Arrange

            // Act
            var result = _notifier.HasNotification();

            // Assert
            result.Should().BeFalse();
        }
Esempio n. 2
0
        public async Task Insert(Customer customer)
        {
            try
            {
                await Validation(customer);

                if (_notifier.HasNotification())
                {
                    return;
                }
                await _context.Insert(customer);
            }
            catch (Exception ex)
            {
                _notifier.SetNotification(new Notification("Não foi possível salvar esse registro, veja o erro:" + ex.Message));
            }
        }
Esempio n. 3
0
        public void Update_User_Not_Found()
        {
            User user = null;

            mockRepository.FindById(Arg.Any <string>()).Returns(user);

            var notification = new Notification("");

            mockNotifier.Handle(notification);
            var erros = mockNotifier.GetNotifications();

            mockNotifier.HasNotification().Returns(true);

            appService.Update("60259848d73bfsss5", Title, FirstName, LastName);

            Assert.True(mockNotifier.HasNotification());
        }
Esempio n. 4
0
        public void Get_User_Not_Found()
        {
            User user = null;

            mockRepository.FindOneAsync(Arg.Any <Expression <Func <User, bool> > >()).Returns(user);

            var notification = new Notification("");

            mockNotifier.Handle(notification);
            var erros = mockNotifier.GetNotifications();

            mockNotifier.HasNotification().Returns(true);

            appService.GetByEmail(Email_Invalido);

            Assert.True(mockNotifier.HasNotification());
        }
Esempio n. 5
0
 private bool HasNotification()
 {
     if (_notifier.HasNotification())
     {
         return(true);
     }
     return(false);
 }
Esempio n. 6
0
        public async Task Save(OrderYesCustomerView orderView)
        {
            try
            {
                await Validation(orderView);

                if (_notifier.HasNotification())
                {
                    return;
                }
                _context.Begin();
                await Save(orderView.DateCreate, orderView.Items);

                _context.Commit();
            }
            catch (Exception ex)
            {
                _context.Rollback();
                _notifier.SetNotification(new Notification("Não foi possível salvar esse registro, veja o erro:" + ex.Message));
            }
        }
Esempio n. 7
0
 public async Task Save(Customer customer)
 {
     Validation(customer);
     if (_notifier.HasNotification())
     {
         return;
     }
     if (customer.Operation == OperationType.Insert)
     {
         await base.Insert(customer);
     }
     else
     {
         await base.Update(customer);
     }
 }
Esempio n. 8
0
 public async Task Save(AccountModel accountModel)
 {
     Validation(accountModel);
     if (_notifier.HasNotification())
     {
         return;
     }
     if (accountModel.Operation == OperationType.Insert)
     {
         await base.Insert(accountModel);
     }
     else
     {
         await base.Update(accountModel);
     }
 }
Esempio n. 9
0
 public async Task Save(AdvertisementModel advertisement)
 {
     Validation(advertisement);
     if (_notifier.HasNotification())
     {
         return;
     }
     if (advertisement.Operation == OperationType.Insert)
     {
         await base.Insert(advertisement);
     }
     else
     {
         await base.Update(advertisement);
     }
 }
Esempio n. 10
0
        public async Task Save(AccountEntryModel origin, AccountEntryModel destiny)
        {
            Validation(origin, destiny);
            if (_notifier.HasNotification())
            {
                return;
            }
            try
            {
                Db.Database.BeginTransaction();
                await base.Insert(origin);

                await base.Insert(destiny);

                Db.Database.CommitTransaction();
            }
            catch (Exception ex)
            {
                _notifier.SetNotification(new Notification("Não foi possível salvar esse registro:" + ex.Message));
                Db.Database.RollbackTransaction();
            }
        }
Esempio n. 11
0
 public bool ValidOperation()
 {
     return(!_notifier.HasNotification());
 }
Esempio n. 12
0
 private bool OperationIsValid()
 {
     return(!_notifier.HasNotification());
 }
Esempio n. 13
0
 protected bool ValidOperation()
 {
     // If not has notification(error) return true
     return(!_notifier.HasNotification());
 }
Esempio n. 14
0
 protected bool IsValid()
 {
     return !_notifier.HasNotification();
 }
Esempio n. 15
0
 public bool HasNotification()
 {
     return(_notifier.HasNotification());
 }
Esempio n. 16
0
 protected bool OperacaoValida()
 {
     return(!_notifier.HasNotification());
 }
Esempio n. 17
0
 protected bool ResponseValid() => !notifier.HasNotification();
Esempio n. 18
0
 protected bool ValidOperation()
 {
     return(_notifier.HasNotification() is false);
 }
Esempio n. 19
0
 protected bool ValidOperation()
 {
     return(!_notifier.HasNotification());
 }
Esempio n. 20
0
 protected bool ValidOperation() => !_notifier.HasNotification();