{"action":"opened","issue":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/612","repository_url":"https://api.github.com/repos/AutoFixture/AutoFixture","labels_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/612/labels{/name}","comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/612/comments","events_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/612/events","html_url":"https://github.com/AutoFixture/AutoFixture/issues/612","id":150654735,"number":612,"title":"Guard clause assertion treating static class as abstract.","user":{"login":"mmkal","id":15040698,"avatar_url":"https://avatars.githubusercontent.com/u/15040698?v=3","gravatar_id":"","url":"https://api.github.com/users/mmkal","html_url":"https://github.com/mmkal","followers_url":"https://api.github.com/users/mmkal/followers","following_url":"https://api.github.com/users/mmkal/following{/other_user}","gists_url":"https://api.github.com/users/mmkal/gists{/gist_id}","starred_url":"https://api.github.com/users/mmkal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmkal/subscriptions","organizations_url":"https://api.github.com/users/mmkal/orgs","repos_url":"https://api.github.com/users/mmkal/repos","events_url":"https://api.github.com/users/mmkal/events{/privacy}","received_events_url":"https://api.github.com/users/mmkal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-24T11:49:27Z","updated_at":"2016-04-24T11:49:27Z","closed_at":null,"body":"I may be doing something wrong here, but it looks like there's a bug somewhere in the GuardClauseAssertion class in AutoFixture.Idioms. I'm trying to use it to test that all arguments passed into a method in a static class are null-checked, but AutoFixture seems to be trying to instantiate the class (even worse, it seems to think it's abstract). Here's a small demo:\r\n\r\n    public interface IMyInterface { }\r\n\r\n    public static class MyStaticClass\r\n    {\r\n        public static void MyMethod(this IMyInterface myInterface)\r\n        {\r\n            if (myInterface == null) throw new ArgumentNullException(nameof(myInterface));\r\n        }\r\n    }\r\n\r\n    public class MyNonStaticClass\r\n    {\r\n        public static void MyMethod(IMyInterface myInterface)\r\n        {\r\n            if (myInterface == null) throw new ArgumentNullException(nameof(myInterface));\r\n        }\r\n    }\r\n    public class TestClass\r\n    {\r\n        public static IEnumerable<object[]> TypesToTest => new[] \r\n        {\r\n            typeof(MyStaticClass),\r\n            typeof(MyNonStaticClass)\r\n        }.Select(t => new[] { t });\r\n\r\n        [Theory]\r\n        [MemberData(nameof(TypesToTest))]\r\n        public void GuardClause_UsingAutoMoq(Type type)\r\n        {\r\n            var fixture = new Fixture().Customize(new AutoConfiguredMoqCustomization());\r\n            var guardClauseAssertion = new GuardClauseAssertion(fixture);\r\n            guardClauseAssertion.Verify(type.GetMethods());\r\n        }\r\n\r\n        [Theory]\r\n        [MemberData(nameof(TypesToTest))]\r\n        public void GuardClause_ManuallyInjectDependency(Type type)\r\n        {\r\n            var fixture = new Fixture();\r\n            IMyInterface myInterface = Mock.Of<IMyInterface>();\r\n            fixture.Inject(myInterface);\r\n            var guardClauseAssertion = new GuardClauseAssertion(fixture);\r\n            guardClauseAssertion.Verify(type.GetMethods());\r\n        }\r\n    }\r\n\r\nThe tests pass when verifying MyNonStatic class, but they fail for MyStatic class with the following exceptions:\r\nFor GuardClause_UsingAutoMoq, it throws `System.NotSupportedException: parent does not have a default constructor. The default constructor must be explicitly defined.`\r\n\r\nFor GuardClause_ManuallyInjectDependency, it throws `Ploeh.AutoFixture.ObjectCreationException: AutoFixture was unable to create an instance from MyStaticClass because it's an abstract class.`\r\n\r\nThis seems wrong to me because:\r\n1. MyStaticClass is not an abstract class, it's a static class.\r\n2. For MyNonStaticClass, which has exactly the same implementation of MyMethod as MyStaticClass, the tests pass.\r\n\r\nI think I have seen slightly different behaviour when the parameters of the static method are concrete types, but that may be a separate issue.\r\n\r\nAm I doing something strange here, or is this a legitimate bug?"}}