public Output execute()
        {
            try
            {
                inputDto.callValidations();
                addValuesFromInputToAdapter();
                invokeValidations();

                Interactor fileVialReader = new FileVialReader();

                return(fileVialReader.execute(inputAdapterDto));
            }
            catch (Exception e) {
                return(prepareErrorResponse(e.Message));
            }
        }
        public OutputDto execute()
        {
            try
            {
                inputDto.callValidations();
                addValuesFromInputToAdapter();

                Shape shape = ModuleConfig.createShape(inputDto.ShapeName, inputAdapterDto.Values);

                inputAdapterDto.Shape = shape;

                Interactor shapeInteractor = new ShapeInteractor();

                return(shapeInteractor.execute(inputAdapterDto));
            }
            catch (Exception e) {
                return(prepareErrorResponse(e.Message));
            }
        }
Example #3
0
        public void when_the_name_of_the_file_is_null_then_throw_exception()
        {
            InputDto input = new InputDto(null);

            input.callValidations();
        }
Example #4
0
        public void when_input_is_correct_then_validations_run_successfully()
        {
            InputDto input = new InputDto("vial-test.csv");

            input.callValidations();
        }
Example #5
0
        public void when_values_are_not_separated_by_comma_then_throw_exception()
        {
            InputDto input = new InputDto("triangle", "area", "2:2;3");

            input.callValidations();
        }
Example #6
0
        public void when_operation_does_not_exist_then_throw_exception()
        {
            InputDto input = new InputDto("rectangle", "are", "2,2");

            input.callValidations();
        }
Example #7
0
        public void when_shape_does_not_exist_then_throw_exception()
        {
            InputDto input = new InputDto("squ", "perimeter", "2");

            input.callValidations();
        }
Example #8
0
        public void when_input_is_correct_then_validations_run_successfully()
        {
            InputDto input = new InputDto("triangle", "area", "2,2,2");

            input.callValidations();
        }