Exemplo n.º 1
0
        public ResponseDTO <IEnumerable <CatalogsDTO> > GetAll(RequestDTO <CompanyFiltersDTO> request)
        {
            var response = new ResponseDTO <IEnumerable <CatalogsDTO> >();

            try
            {
                response = clientLogic.GetAll(request.Signature);
            }
            catch (System.Data.SqlClient.SqlException exception)
            {
                response.Success = false;
                response.Message = exception.Message;
                ExceptionHandler.Instance.WriteExceptionLog(exception);
            }
            catch (System.Exception exception)
            {
                response.Success = false;
                response.Message = exception.Message;
                ExceptionHandler.Instance.WriteExceptionLog(exception);
            }
            return(response);
        }
Exemplo n.º 2
0
        public void ClientLogicGetAllShouldReturnClientViewModel()
        {
            // arrange
            var repository  = new Mock <IClientRepository>();
            var clientLogic = new ClientLogic(repository.Object);

            repository.Setup(c => c.GetAll())
            .Returns(new List <Client>()
            {
                new Client
                {
                    Id        = 1,
                    Name      = "David",
                    Employees = new List <Employee>()
                    {
                        new Employee(),
                        new Employee()
                    },
                    ExternalEmployees = new List <Employee>()
                    {
                        new Employee(),
                        new Employee()
                    }
                }
            });

            // act
            var result = clientLogic.GetAll();

            // assert
            Assert.AreEqual(typeof(List <ClientViewModel>), result.GetType());
            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result.First().Name, "David");
            Assert.AreEqual(result.First().Id, 1);
            Assert.AreEqual(result.First().EmployeesCount, 4);
        }
Exemplo n.º 3
0
 public AddCarForm()
 {
     InitializeComponent();
     ClientsCBox.DataSource = clientLogic.GetAll();
     MarkCBox.DataSource    = markLogic.GetAll();
 }
Exemplo n.º 4
0
 public ClientAdminForm()
 {
     InitializeComponent();
     ClientTable.DataSource = clientLogic.GetAll();
 }