public async Task <IActionResult> BuildAdvanced([FromQuery] BuildAdvancedDto parameters) { if (ModelState.IsValid) { try { RecommendationListBuilder builder = new RecommendationListBuilder(MovieSearchService); BillboardGenerator generator = new BillboardGenerator(); BlockBusterRule rule = new BlockBusterRule(); var criteria = await GetCriteriaBuilder(parameters).CompileCriteria(); var list = await builder.BuildList(criteria); var result = generator.Generate(list, parameters.weekCount.Value, parameters.bigScreenCount, parameters.smallScreenCount, rule.IsBlockBusterGenre); return(Ok(new AdvancedBillboardResult { Billboard = result })); } catch (InsufficientItemsException generatorErr) { ErrorResult errorObj = new ErrorResult { status_message = generatorErr.Message }; return(StatusCode(StatusCodes.Status400BadRequest, errorObj)); } catch (NotImplementedException notImplementedErr) { ErrorResult errorObj = new ErrorResult { status_message = notImplementedErr.Message }; return(StatusCode(StatusCodes.Status501NotImplemented, errorObj)); } catch (Exception e) { ErrorResult errorObj = new ErrorResult { status_message = e.Message }; return(StatusCode(StatusCodes.Status500InternalServerError, errorObj)); } } else { return(NotFound()); } }
public void TearDown() { TestObject = null; }
public void Setup() { TestObject = new BlockBusterRule(); }