{"action":"closed","issue":{"url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/484","repository_url":"https://api.github.com/repos/nsubstitute/NSubstitute","labels_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/484/labels{/name}","comments_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/484/comments","events_url":"https://api.github.com/repos/nsubstitute/NSubstitute/issues/484/events","html_url":"https://github.com/nsubstitute/NSubstitute/issues/484","id":381224194,"node_id":"MDU6SXNzdWUzODEyMjQxOTQ=","number":484,"title":"Callback not fired for void when Arg.Any passed","user":{"login":"mkolumb","id":12272082,"node_id":"MDQ6VXNlcjEyMjcyMDgy","avatar_url":"https://avatars2.githubusercontent.com/u/12272082?v=4","gravatar_id":"","url":"https://api.github.com/users/mkolumb","html_url":"https://github.com/mkolumb","followers_url":"https://api.github.com/users/mkolumb/followers","following_url":"https://api.github.com/users/mkolumb/following{/other_user}","gists_url":"https://api.github.com/users/mkolumb/gists{/gist_id}","starred_url":"https://api.github.com/users/mkolumb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkolumb/subscriptions","organizations_url":"https://api.github.com/users/mkolumb/orgs","repos_url":"https://api.github.com/users/mkolumb/repos","events_url":"https://api.github.com/users/mkolumb/events{/privacy}","received_events_url":"https://api.github.com/users/mkolumb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-15T15:53:42Z","updated_at":"2018-11-15T21:51:03Z","closed_at":"2018-11-15T21:51:03Z","author_association":"NONE","body":"**Describe the bug**\r\nI am using the Fluent Assertions for clear assertions but it doesn't affect this bug.\r\n\r\nI have interface with the following method\r\n```CSharp\r\nvoid ReduceProductAvailability(int productId, int orderedQuantity);\r\n```\r\n\r\nWhen I create the substitute which throws exception for this\r\n\r\n```CSharp\r\nvar service = Substitute.For<IProductService>();\r\n\r\nservice\r\n    .When(e => e.ReduceProductAvailability(Arg.Any<int>(), Arg.Any<int>()))\r\n    .Do(x => throw new NotFoundException(\"XYZ\"));\r\n```\r\n\r\nIt not throws when in execution I use \r\n```CSharp\r\nservice.ReduceProductAvailability(Arg.Any<int>(), Arg.Any<int>())\r\n```\r\n\r\nbut it works if I use simple parameters\r\n```CSharp\r\nservice.ReduceProductAvailability(0, 0)\r\n```\r\n\r\n\r\n**To Reproduce**\r\nCompare two of the following tests\r\n\r\n1. This works\r\n    ```CSharp\r\n    // Arrange\r\n\r\n    var service = Substitute.For<IProductService>();\r\n\r\n    service\r\n        .When(e => e.ReduceProductAvailability(Arg.Any<int>(), Arg.Any<int>()))\r\n        .Do(x => throw new NotFoundException(\"XYZ\"));\r\n\r\n    // Act\r\n\r\n    Action result = () => service.ReduceProductAvailability(0, 0);\r\n\r\n    // Assert\r\n\r\n    result.Should().Throw<NotFoundException>();\r\n    ```\r\n\r\n2. This not\r\n    ```CSharp\r\n    // Arrange\r\n\r\n    var service = Substitute.For<IProductService>();\r\n\r\n    service\r\n        .When(e => e.ReduceProductAvailability(Arg.Any<int>(), Arg.Any<int>()))\r\n        .Do(x => throw new NotFoundException(\"XYZ\"));\r\n\r\n    // Act\r\n\r\n    Action result = () => service.ReduceProductAvailability(Arg.Any<int>(), Arg.Any<int>());\r\n\r\n    // Assert\r\n\r\n    result.Should().Throw<NotFoundException>();\r\n    ```\r\n\r\n**Expected behaviour**\r\nIt should throws the exception in both cases\r\n\r\n**Environment:**\r\n - NSubstitute version: 3.1.0\r\n - XUnit: 2.4.1\r\n - FluentAssertions: 5.5.0\r\n - Platform: dotnetcore2.1 project on Windows"}}
{"actor":{"display_login":"mkolumb"}}