Esempio n. 1
0
 public async Task <ActionResult <IEnumerable <CustomerModel> > > Get()
 {
     try
     {
         return(Ok(await _customerBusinessLayer.GetAllCustomersAsync()));
     }
     catch (Exception ex)
     {
         _logger.LogInformation(ex, "Exception occured getting customers");
         return(BadRequest());
     }
 }
        public void GetAllCustomersAsync_GetAllCustomers_GetsAllCustomersAsync()
        {
            CustomerBusinessLayer       businessLayer        = _fixture.CustomerBusinessLayer;
            IEnumerable <CustomerModel> customerModels       = _fixture.CustomerModels;
            IEnumerable <CustomerModel> customerModelsResult = Enumerable.Empty <CustomerModel>();

            Func <Task> test = async() =>
            {
                customerModelsResult = await businessLayer.GetAllCustomersAsync();
            };

            test.Should()
            .NotThrow();

            customerModelsResult.Should()
            .NotBeNullOrEmpty()
            .And
            .BeEquivalentTo(customerModels);
        }