{"action":"created","issue":{"url":"https://api.github.com/repos/nunit/nunit/issues/841","labels_url":"https://api.github.com/repos/nunit/nunit/issues/841/labels{/name}","comments_url":"https://api.github.com/repos/nunit/nunit/issues/841/comments","events_url":"https://api.github.com/repos/nunit/nunit/issues/841/events","html_url":"https://github.com/nunit/nunit/issues/841","id":107951004,"number":841,"title":"Moq as TestCaseSource dosen't work","user":{"login":"meriturva","id":5664195,"avatar_url":"https://avatars.githubusercontent.com/u/5664195?v=3","gravatar_id":"","url":"https://api.github.com/users/meriturva","html_url":"https://github.com/meriturva","followers_url":"https://api.github.com/users/meriturva/followers","following_url":"https://api.github.com/users/meriturva/following{/other_user}","gists_url":"https://api.github.com/users/meriturva/gists{/gist_id}","starred_url":"https://api.github.com/users/meriturva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meriturva/subscriptions","organizations_url":"https://api.github.com/users/meriturva/orgs","repos_url":"https://api.github.com/users/meriturva/repos","events_url":"https://api.github.com/users/meriturva/events{/privacy}","received_events_url":"https://api.github.com/users/meriturva/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nunit/nunit/labels/status:confirm","name":"status:confirm","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/nunit/nunit/milestones/14","html_url":"https://github.com/nunit/nunit/milestones/3.0RC","labels_url":"https://api.github.com/repos/nunit/nunit/milestones/14/labels","id":1173766,"number":14,"title":"3.0RC","description":"","creator":{"login":"CharliePoole","id":2678661,"avatar_url":"https://avatars.githubusercontent.com/u/2678661?v=3","gravatar_id":"","url":"https://api.github.com/users/CharliePoole","html_url":"https://github.com/CharliePoole","followers_url":"https://api.github.com/users/CharliePoole/followers","following_url":"https://api.github.com/users/CharliePoole/following{/other_user}","gists_url":"https://api.github.com/users/CharliePoole/gists{/gist_id}","starred_url":"https://api.github.com/users/CharliePoole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharliePoole/subscriptions","organizations_url":"https://api.github.com/users/CharliePoole/orgs","repos_url":"https://api.github.com/users/CharliePoole/repos","events_url":"https://api.github.com/users/CharliePoole/events{/privacy}","received_events_url":"https://api.github.com/users/CharliePoole/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":14,"state":"open","created_at":"2015-06-21T02:40:59Z","updated_at":"2015-09-23T17:39:12Z","due_on":"2015-09-30T04:00:00Z","closed_at":null},"comments":2,"created_at":"2015-09-23T15:53:33Z","updated_at":"2015-09-23T19:18:12Z","closed_at":null,"body":"Hi to all,\r\nwe use TestCaseSource with Mock instances and we found that the test is not called.\r\nWe use the NUnit 3 beta 4 version with Visual Studio 2015 Community Edition.\r\nThis is just a sample code to reproduce the problem:\r\n\r\n```C#\r\n    public class Value\r\n    {\r\n        public double RowVale { get; set; }\r\n    }\r\n\r\n    [TestFixture]\r\n    public class TestTest\r\n    {\r\n        private static Value[] Values = new Test.Value[2];\r\n        \r\n        static TestTest()\r\n        {\r\n            Values[0] = new Value()\r\n            {\r\n                RowVale = 10\r\n            };\r\n\r\n            var mockValue = new Mock<Value>();\r\n            Values[1] = mockValue.Object;\r\n        }\r\n\r\n        [Test, TestCaseSource(\"Values\")]\r\n        public void TestTestCaseSourceWithMoq(Value value)\r\n        {\r\n           \r\n        }\r\n\r\n    }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nunit/nunit/issues/comments/142702249","html_url":"https://github.com/nunit/nunit/issues/841#issuecomment-142702249","issue_url":"https://api.github.com/repos/nunit/nunit/issues/841","id":142702249,"user":{"login":"CharliePoole","id":2678661,"avatar_url":"https://avatars.githubusercontent.com/u/2678661?v=3","gravatar_id":"","url":"https://api.github.com/users/CharliePoole","html_url":"https://github.com/CharliePoole","followers_url":"https://api.github.com/users/CharliePoole/followers","following_url":"https://api.github.com/users/CharliePoole/following{/other_user}","gists_url":"https://api.github.com/users/CharliePoole/gists{/gist_id}","starred_url":"https://api.github.com/users/CharliePoole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharliePoole/subscriptions","organizations_url":"https://api.github.com/users/CharliePoole/orgs","repos_url":"https://api.github.com/users/CharliePoole/repos","events_url":"https://api.github.com/users/CharliePoole/events{/privacy}","received_events_url":"https://api.github.com/users/CharliePoole/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T19:18:12Z","updated_at":"2015-09-23T19:18:12Z","body":"The test cases are created at the time your tests are loaded, using a mock created at that time. Then, when the tests are executed, a new object is created and Values array is re-initialized. However, that initialization cannot impact the cases that are run because they are already defined.\r\n\r\nIt could be that Moq introduces a new variable into the problem but it really comes down to a standard issue/feature of NUnit: that test case initialization is static and can't be affected by anything that takes place during the execution of a test run. We already have plans to add dynamic test cases in a future release.\r\n\r\nI'd be inclined to close this as wontfix or notabug."}}