Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checks when multiple [Route] #59

Open
2 tasks
JohanLarsson opened this issue Jan 17, 2019 · 1 comment
Open
2 tasks

Checks when multiple [Route] #59

JohanLarsson opened this issue Jan 17, 2019 · 1 comment

Comments

@JohanLarsson
Copy link
Collaborator

    [Route("api/values/{id}")]
    [Route("api/values")]
    [ApiController]
    public class FoosController : ControllerBase

Check that

  • at least one action method has parameter id
  • at least one action method does not have parameter id
@JohanLarsson
Copy link
Collaborator Author

        [Test]
        public void WhenMultipleRouteAttributesMissingAction()
        {
            var code = @"
namespace AspBox
{
    using Microsoft.AspNetCore.Mvc;

    [Route(↓""api/values"")]
    [Route(""api/values/{id}"")]
    [ApiController]
    public class ValuesController : Controller
    {
        [HttpGet]
        public IActionResult Get(int id)
        {
            return this.Ok(id);
        }
    }
}";

            AnalyzerAssert.Diagnostics(Analyzer, ExpectedDiagnostic, code);
        }

Maybe this should be a new id?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant