public void ReportDetailedUseCaseEqualTest() { GetReportDetailedRequest getReportDetailedRequest = new GetReportDetailedRequest(category, sinceDate, toDate); IRepositoryFactory repositoryFactory = new RepositoryFactory(new DBContext()); IActivityFactory activityFactory = new ActivityFactory(repositoryFactory, new ValidationRuleFactory()); IUseCaseFactory useCaseFactory = new UseCaseFactory(activityFactory); GetReportDetailedResponse getReportDetailedResponse = useCaseFactory.Create <IUseCase <GetReportDetailedRequest, GetReportDetailedResponse> >().Execute(getReportDetailedRequest); Assert.IsTrue(getReportDetailedResponse.ReportDetaileds.Count == 2); }
public void ReportDetailedUseCaseNotEqualTest() { Exception exception = null; try { IRepositoryFactory repositoryFactory = new RepositoryFactory(new DBContext()); IActivityFactory activityFactory = new ActivityFactory(repositoryFactory, new ValidationRuleFactory()); IUseCaseFactory useCaseFactory = new UseCaseFactory(activityFactory); GetReportDetailedRequest getReportDetailedRequest = new GetReportDetailedRequest(category, "", "asd"); GetReportDetailedResponse getReportDetailedResponse = useCaseFactory.Create <IUseCase <GetReportDetailedRequest, GetReportDetailedResponse> >().Execute(getReportDetailedRequest); } catch (Exception ex) { exception = ex; } Assert.AreEqual(exception.Message, "Date must be filled!"); }
public async Task <OperationStatusInfo> ShowReportDetailed(Category category, DateTime sinceDate, DateTime toDate) { return(await Task.Run(() => { OperationStatusInfo operationStatusInfo = new OperationStatusInfo(operationStatus: OperationStatus.Done); GetReportDetailedRequest getReportDetailedRequest = new GetReportDetailedRequest(category, sinceDate.ToString(), toDate.ToString()); try { GetReportDetailedResponse getReportDetailedResponse = hubEnvironment.UseCaseFactory .Create <IUseCase <GetReportDetailedRequest, GetReportDetailedResponse> >() .Execute(getReportDetailedRequest); operationStatusInfo.AttachedObject = getReportDetailedResponse.ReportDetaileds; } catch (Exception ex) { Console.WriteLine(ex.Message); operationStatusInfo.OperationStatus = OperationStatus.Cancelled; operationStatusInfo.AttachedInfo = ex.Message; } return operationStatusInfo; })); }