{"action":"created","issue":{"url":"https://api.github.com/repos/moq/moq4/issues/265","repository_url":"https://api.github.com/repos/moq/moq4","labels_url":"https://api.github.com/repos/moq/moq4/issues/265/labels{/name}","comments_url":"https://api.github.com/repos/moq/moq4/issues/265/comments","events_url":"https://api.github.com/repos/moq/moq4/issues/265/events","html_url":"https://github.com/moq/moq4/issues/265","id":157478408,"number":265,"title":"It.IsAny<decimal> throws \"System.decimal is not a supported constant type\"","user":{"login":"dinismvcorreia","id":18035050,"avatar_url":"https://avatars.githubusercontent.com/u/18035050?v=3","gravatar_id":"","url":"https://api.github.com/users/dinismvcorreia","html_url":"https://github.com/dinismvcorreia","followers_url":"https://api.github.com/users/dinismvcorreia/followers","following_url":"https://api.github.com/users/dinismvcorreia/following{/other_user}","gists_url":"https://api.github.com/users/dinismvcorreia/gists{/gist_id}","starred_url":"https://api.github.com/users/dinismvcorreia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinismvcorreia/subscriptions","organizations_url":"https://api.github.com/users/dinismvcorreia/orgs","repos_url":"https://api.github.com/users/dinismvcorreia/repos","events_url":"https://api.github.com/users/dinismvcorreia/events{/privacy}","received_events_url":"https://api.github.com/users/dinismvcorreia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-05-30T10:45:47Z","updated_at":"2016-11-18T17:09:02Z","closed_at":null,"body":"I was using Moq 4.5.3. and decided to update Moq Nuget package to the latest version, which is 4.5.8.\nSuddenly, a lot of my tests started to fail. I found that the issue occurs when using `It.IsAny<decimal>` on decimal optional arguments. It throws \"System.decimal is not a supported constant type\". It also happens in version 4.5.7.\nSimple, silly test:\n\n```\npublic interface IFoo { bool Method(decimal decimalArg = 0m); }\n\npublic class Some\n{\n    public int SomeMethod(IFoo foo) => foo.Method(10m) ? 1 : 0;\n}\n\n[TestFixture]\npublic class SomeTests\n{\n    [Test]\n    public void SampleTest()\n    {\n        var fooMock = new Mock<IFoo>();\n        fooMock.Setup(m => m.Method(It.IsAny<decimal>())).Returns(true);\n\n        var sut = new Some();\n        var actual = sut.SomeMethod(fooMock.Object);\n\n        Assert.That(actual, Is.EqualTo(1));\n    }\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/moq/moq4/issues/comments/261585892","html_url":"https://github.com/moq/moq4/issues/265#issuecomment-261585892","issue_url":"https://api.github.com/repos/moq/moq4/issues/265","id":261585892,"user":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T17:09:02Z","updated_at":"2016-11-18T17:09:02Z","body":"I hit what I believe is a similar issue trying to mock some Visual Studio Interfaces:\r\n\r\n> System.Runtime.InteropServices.DispatchWrapper is not a supported constant type.\r\n\r\nIt does appear to be a dupe of the castle bug: https://github.com/castleproject/Core/issues/87\r\n\r\nIn my tests I was able to work around this by upgrading the Castle NuGet package to 4.0.0-beta002.  "}}
{"actor":{"display_login":"jaredpar"}}