{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/5992","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/5992/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/5992/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/5992/events","html_url":"https://github.com/aspnet/Mvc/issues/5992","id":215319009,"number":5992,"title":"HTTP 404 with ASP.NET Core Test Server when controllers are added to a seperate assembly","user":{"login":"JamieKeeling","id":7165035,"avatar_url":"https://avatars2.githubusercontent.com/u/7165035?v=4","gravatar_id":"","url":"https://api.github.com/users/JamieKeeling","html_url":"https://github.com/JamieKeeling","followers_url":"https://api.github.com/users/JamieKeeling/followers","following_url":"https://api.github.com/users/JamieKeeling/following{/other_user}","gists_url":"https://api.github.com/users/JamieKeeling/gists{/gist_id}","starred_url":"https://api.github.com/users/JamieKeeling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamieKeeling/subscriptions","organizations_url":"https://api.github.com/users/JamieKeeling/orgs","repos_url":"https://api.github.com/users/JamieKeeling/repos","events_url":"https://api.github.com/users/JamieKeeling/events{/privacy}","received_events_url":"https://api.github.com/users/JamieKeeling/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-03-20T02:41:47Z","updated_at":"2018-03-15T21:23:13Z","closed_at":"2017-07-17T06:31:37Z","author_association":"NONE","body":"I have a basic test controller within my ASP.NET Core application:\r\n\r\n```\r\nusing Microsoft.AspNetCore.Mvc;\r\n\r\nnamespace Web.Controllers\r\n{\r\n    [Route(\"api/[controller]\")]\r\n    public class TestController : Controller\r\n    {\r\n        [HttpGet]\r\n        public IActionResult Test()\r\n        {\r\n            return Ok();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThis is stored within my VS solution as follows:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/7165035/24087248/94000372-0d14-11e7-93c9-9d5a7e8fe948.png)\r\n\r\nWith this configuration I receive a HTTP 200 when attempting to access TestController via localhost, and my integration test passes using the following scenario:\r\n\r\n```\r\nusing Microsoft.AspNetCore.Hosting;\r\nusing Microsoft.AspNetCore.TestHost;\r\nusing System.Net.Http;\r\nusing System.Threading.Tasks;\r\nusing Web;\r\nusing Xunit;\r\nusing System.Net;\r\n\r\nnamespace IntegrationTests.Controllers\r\n{\r\n    public class CustomerControllerTests\r\n    {\r\n        private readonly TestServer _server;\r\n        private readonly HttpClient _client;\r\n\r\n        public CustomerControllerTests()\r\n        {\r\n            _server = new TestServer(new WebHostBuilder().UseStartup<Startup>());\r\n            _client = _server.CreateClient();\r\n        }\r\n\r\n        [Fact]\r\n        public async Task HttpPost_TestController_ReturnsSuccess()\r\n        {\r\n            var response = await _client.GetAsync(\"/api/test\");\r\n\r\n            Assert.Equal(HttpStatusCode.OK, response.StatusCode);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nIf I move the same controller to a separate .NET Standard based library in the following structure:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/7165035/24087279/f9034b26-0d14-11e7-92ec-9bf1e61b43b8.png)\r\n\r\nIn addition to ensuring my 'Web' project references the given library:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/7165035/24087305/2ed48968-0d15-11e7-8f93-fc14f0eb9bf8.png)\r\n\r\nThen the same integration test referenced above fails, however the localhost test returns a HTTP 200 as expected.\r\n\r\nI would expect the seperation of the TestController into a seperate binary to work against the TestServer too - have I missed a manual step?\r\n\r\nFor reference there's a reproducable example here - https://github.com/JamieKeeling/HelloWorldCore/tree/ControllerBinary"},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/373527322","html_url":"https://github.com/aspnet/Mvc/issues/5992#issuecomment-373527322","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/5992","id":373527322,"user":{"login":"alexsandro-xpt","id":845657,"avatar_url":"https://avatars2.githubusercontent.com/u/845657?v=4","gravatar_id":"","url":"https://api.github.com/users/alexsandro-xpt","html_url":"https://github.com/alexsandro-xpt","followers_url":"https://api.github.com/users/alexsandro-xpt/followers","following_url":"https://api.github.com/users/alexsandro-xpt/following{/other_user}","gists_url":"https://api.github.com/users/alexsandro-xpt/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsandro-xpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsandro-xpt/subscriptions","organizations_url":"https://api.github.com/users/alexsandro-xpt/orgs","repos_url":"https://api.github.com/users/alexsandro-xpt/repos","events_url":"https://api.github.com/users/alexsandro-xpt/events{/privacy}","received_events_url":"https://api.github.com/users/alexsandro-xpt/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T21:23:13Z","updated_at":"2018-03-15T21:23:13Z","author_association":"NONE","body":"How can I use this `Microsoft.AspNetCore.Testing` package?\r\nI'm install it from myget normaly at my test project.\r\n```\r\n<PackageReference Include=\"Microsoft.AspNetCore.Mvc\" Version=\"2.0.2\" />\r\n<PackageReference Include=\"Microsoft.AspNetCore.TestHost\" Version=\"2.0.2\" />\r\n<PackageReference Include=\"Microsoft.AspNetCore.Testing\" Version=\"2.1.0-preview1-28285\" />\r\n<PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"15.5.0\" />\r\n```\r\n\r\nBut and now?"}}
{"actor":{"display_login":"alexsandro-xpt"}}