public void HandlerCalledWithParams_GetsResourceDetails()
        {
            var details = new ResourceDetails();
            _mockDiscoverer.Setup(x => x.GetResouceDetails("path")).Returns(details);

            var response = _handler.Get("path");

            Assert.That(response, Is.EqualTo(details));
        }
        public ResourceDetails GetResouceDetails(string groupPath)
        {
            var swaggerSpec = new ResourceDetails
            {
                swaggerVersion = "1.2",
                apiVersion = Assembly.GetCallingAssembly().GetName().Version.ToString(),
                apis = new List<ApiDetails>(),
                resourcePath = "/",
                basePath = "/"
            };

            var groupOperations =
                Operations().Where(x => x.Group.Path.Equals(groupPath, StringComparison.InvariantCultureIgnoreCase));

            var typeMapper = new TypeMapper();

            foreach (var operationMetadata in groupOperations)
            {
                var mappedReturnType = typeMapper.Register(operationMetadata.ReturnType);

                var op = new Operation
                {
                    method = operationMetadata.HttpVerb,
                    nickname = operationMetadata.Nickname ?? "",
                    notes = operationMetadata.Notes ?? "",
                    type = mappedReturnType.Type,
                    items = mappedReturnType.Items,
                    summary = operationMetadata.Summary ?? "",
                    parameters = new List<Parameter>(),
                    responseMessages = new List<Responsemessage>()
                };

                foreach (var header in SwaggerGenerator.Configuration.Headers)
                {
                    op.parameters.Add(new Parameter
                    {
                        paramType = "header",
                        name = header.Name,
                        required = true,
                        description = header.SuggestedValue,
                        type = "string",
                        minimum = 1,
                        maximum = 1
                    });
                }

                foreach (var param in operationMetadata.InputParameters)
                {
                    var swagParam = typeMapper.Map(param);
                    swagParam.paramType = param.LocationType.ToString().ToLower();
                    op.parameters.Add(swagParam);
                }

                foreach (var code in operationMetadata.ResponseCodes)
                {
                    op.responseMessages.Add(new Responsemessage {code = code.StatusCode, message = code.Description});
                }

                swaggerSpec.apis.Add(new ApiDetails
                {
                    description = operationMetadata.Summary,
                    path = operationMetadata.UriParser.Path,
                    operations = new List<Operation> {op}
                });
            }

            foreach (var item in typeMapper.Models)
            {
                swaggerSpec.models.Add(item.id, item);
            }

            return swaggerSpec;
        }