public void GetSaleUseCaseEqualTest() { Department department = new Department() { Id = 1 }; GetSaleRequest getSaleRequest = new GetSaleRequest(department); IRepositoryFactory repositoryFactory = new RepositoryFactory(new DBContext()); IActivityFactory activityFactory = new ActivityFactory(repositoryFactory, new ValidationRuleFactory()); IUseCaseFactory useCaseFactory = new UseCaseFactory(activityFactory); GetSaleResponse getClassResponse = useCaseFactory.Create <IUseCase <GetSaleRequest, GetSaleResponse> >().Execute(getSaleRequest); Assert.IsTrue(getClassResponse.Sales.Count > 0); }
public async Task <OperationStatusInfo> ShowSales(Department department) { return(await Task.Run(() => { OperationStatusInfo operationStatusInfo = new OperationStatusInfo(operationStatus: OperationStatus.Done); GetSaleRequest getSaleRequest = new GetSaleRequest(department); try { GetSaleResponse getSaleResponse = hubEnvironment.UseCaseFactory .Create <IUseCase <GetSaleRequest, GetSaleResponse> >() .Execute(getSaleRequest); operationStatusInfo.AttachedObject = getSaleResponse.Sales; } catch (Exception ex) { Console.WriteLine(ex.Message); operationStatusInfo.OperationStatus = OperationStatus.Cancelled; operationStatusInfo.AttachedInfo = ex.Message; } return operationStatusInfo; })); }