/// <summary> /// Facade class - Process and orchestrate other service implementation /// </summary> /// <param name="input">Long Int</param> /// <returns>Service Codes - Success, Invalid Input, Error</returns> public ServiceCode Process(long input) { try { _logger.LogInformation("Processing input.."); _logger.LogDebug($"Processing value - {input}"); var numbers = _numberService.GetValues(input); if (numbers.Count > 0) { var gridOutput = _operatorService.Execute(numbers); if (!string.IsNullOrEmpty(gridOutput)) { _printService.Print(gridOutput); _logger.LogInformation("Processing Complete"); return(ServiceCode.SUCCESS); } _logger.LogInformation("Error while generating table, Empty response."); return(ServiceCode.APPLICATION_ERROR); } _logger.LogInformation("Invalid Input. Nothing to process.."); return(ServiceCode.INVALID_INPUT); } catch (Exception ex) { _logger.LogError(ex, "Error while processing.. Check exception details"); return(ServiceCode.SYSTEM_ERROR); } }
public void ValidInput_ValidCount() { //Arrange _numberService = new PrimeNumbers(_mockLogger.Object); //Act var output = _numberService.GetValues(10); //Assert Assert.NotEmpty(output); }