{"action":"created","issue":{"url":"https://api.github.com/repos/tmenier/Flurl/issues/335","repository_url":"https://api.github.com/repos/tmenier/Flurl","labels_url":"https://api.github.com/repos/tmenier/Flurl/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/tmenier/Flurl/issues/335/comments","events_url":"https://api.github.com/repos/tmenier/Flurl/issues/335/events","html_url":"https://github.com/tmenier/Flurl/issues/335","id":335736443,"node_id":"MDU6SXNzdWUzMzU3MzY0NDM=","number":335,"title":"HttpTest.ShouldHaveCalled() throws NullReferenceException ","user":{"login":"nicemd","id":9823219,"node_id":"MDQ6VXNlcjk4MjMyMTk=","avatar_url":"https://avatars2.githubusercontent.com/u/9823219?v=4","gravatar_id":"","url":"https://api.github.com/users/nicemd","html_url":"https://github.com/nicemd","followers_url":"https://api.github.com/users/nicemd/followers","following_url":"https://api.github.com/users/nicemd/following{/other_user}","gists_url":"https://api.github.com/users/nicemd/gists{/gist_id}","starred_url":"https://api.github.com/users/nicemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicemd/subscriptions","organizations_url":"https://api.github.com/users/nicemd/orgs","repos_url":"https://api.github.com/users/nicemd/repos","events_url":"https://api.github.com/users/nicemd/events{/privacy}","received_events_url":"https://api.github.com/users/nicemd/received_events","type":"User","site_admin":false},"labels":[{"id":80939045,"node_id":"MDU6TGFiZWw4MDkzOTA0NQ==","url":"https://api.github.com/repos/tmenier/Flurl/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/tmenier/Flurl/milestones/24","html_url":"https://github.com/tmenier/Flurl/milestone/24","labels_url":"https://api.github.com/repos/tmenier/Flurl/milestones/24/labels","id":3309347,"node_id":"MDk6TWlsZXN0b25lMzMwOTM0Nw==","number":24,"title":"Flurl.Http 2.3.2","description":null,"creator":{"login":"tmenier","id":1350414,"node_id":"MDQ6VXNlcjEzNTA0MTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1350414?v=4","gravatar_id":"","url":"https://api.github.com/users/tmenier","html_url":"https://github.com/tmenier","followers_url":"https://api.github.com/users/tmenier/followers","following_url":"https://api.github.com/users/tmenier/following{/other_user}","gists_url":"https://api.github.com/users/tmenier/gists{/gist_id}","starred_url":"https://api.github.com/users/tmenier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmenier/subscriptions","organizations_url":"https://api.github.com/users/tmenier/orgs","repos_url":"https://api.github.com/users/tmenier/repos","events_url":"https://api.github.com/users/tmenier/events{/privacy}","received_events_url":"https://api.github.com/users/tmenier/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":6,"state":"open","created_at":"2018-04-30T15:11:23Z","updated_at":"2018-07-03T16:26:46Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2018-06-26T09:35:45Z","updated_at":"2018-07-03T16:31:12Z","closed_at":"2018-07-03T16:26:45Z","author_association":"NONE","body":"When not using Flurl for sending the http request, HttpTest.ShouldHaveCalled() throws NullReferenceException.\r\n\r\nI was trying to use HttpTest to test a client that uses an ordinary injected HttpClient for sending request.\r\n\r\n```\r\n        [Fact]\r\n        public async Task Not_Working()\r\n        {\r\n            using (var httpTest = new HttpTest())\r\n            {\r\n                httpTest.RespondWith(\"Hello\");\r\n                var flurClient = new FlurlClient();\r\n                await flurClient.HttpClient.GetStringAsync(\"http://google.com/\");\r\n                httpTest.ShouldHaveCalled(\"http://google.com/\");\r\n            }\r\n        }\r\n\r\n        [Fact]\r\n        public async Task Working()\r\n        {\r\n            using (var httpTest = new HttpTest())\r\n            {\r\n                httpTest.RespondWith(\"Hello\");\r\n                var flurClient = new FlurlClient();\r\n                await \"http://google.com/\".GetStringAsync();\r\n                httpTest.ShouldHaveCalled(\"http://google.com/\");\r\n            }\r\n        }\r\n```\r\n```\r\nSystem.NullReferenceException : Object reference not set to an instance of an object.\r\n   at Flurl.Http.Testing.HttpCallAssertion.<>c__DisplayClass5_0.<WithUrlPattern>b__0(HttpCall c)\r\n   at System.Linq.Enumerable.WhereListIterator`1.ToList()\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at Flurl.Http.Testing.HttpCallAssertion.With(Func`2 match)\r\n   at Flurl.Http.Testing.HttpCallAssertion.WithUrlPattern(String urlPattern)\r\n```\r\nVersion 2.3.1\r\n"},"comment":{"url":"https://api.github.com/repos/tmenier/Flurl/issues/comments/402217340","html_url":"https://github.com/tmenier/Flurl/issues/335#issuecomment-402217340","issue_url":"https://api.github.com/repos/tmenier/Flurl/issues/335","id":402217340,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjIxNzM0MA==","user":{"login":"tmenier","id":1350414,"node_id":"MDQ6VXNlcjEzNTA0MTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1350414?v=4","gravatar_id":"","url":"https://api.github.com/users/tmenier","html_url":"https://github.com/tmenier","followers_url":"https://api.github.com/users/tmenier/followers","following_url":"https://api.github.com/users/tmenier/following{/other_user}","gists_url":"https://api.github.com/users/tmenier/gists{/gist_id}","starred_url":"https://api.github.com/users/tmenier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmenier/subscriptions","organizations_url":"https://api.github.com/users/tmenier/orgs","repos_url":"https://api.github.com/users/tmenier/repos","events_url":"https://api.github.com/users/tmenier/events{/privacy}","received_events_url":"https://api.github.com/users/tmenier/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T16:31:12Z","updated_at":"2018-07-03T16:31:12Z","author_association":"OWNER","body":"This fix has been released: https://www.nuget.org/packages/Flurl.Http/2.3.2"}}
{"actor":{"display_login":"tmenier"}}