{"action":"created","issue":{"url":"https://api.github.com/repos/moq/moq4/issues/419","repository_url":"https://api.github.com/repos/moq/moq4","labels_url":"https://api.github.com/repos/moq/moq4/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/moq/moq4/issues/419/comments","events_url":"https://api.github.com/repos/moq/moq4/issues/419/events","html_url":"https://github.com/moq/moq4/issues/419","id":242715173,"number":419,"title":"Hi, moq verson 4.7.63 CallBase not Work","user":{"login":"Damian-Pumar","id":7398909,"avatar_url":"https://avatars0.githubusercontent.com/u/7398909?v=3","gravatar_id":"","url":"https://api.github.com/users/Damian-Pumar","html_url":"https://github.com/Damian-Pumar","followers_url":"https://api.github.com/users/Damian-Pumar/followers","following_url":"https://api.github.com/users/Damian-Pumar/following{/other_user}","gists_url":"https://api.github.com/users/Damian-Pumar/gists{/gist_id}","starred_url":"https://api.github.com/users/Damian-Pumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Damian-Pumar/subscriptions","organizations_url":"https://api.github.com/users/Damian-Pumar/orgs","repos_url":"https://api.github.com/users/Damian-Pumar/repos","events_url":"https://api.github.com/users/Damian-Pumar/events{/privacy}","received_events_url":"https://api.github.com/users/Damian-Pumar/received_events","type":"User","site_admin":false},"labels":[{"id":633728320,"url":"https://api.github.com/repos/moq/moq4/labels/needs-repro","name":"needs-repro","color":"ffaa00","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-07-13T14:13:08Z","updated_at":"2017-07-13T19:45:07Z","closed_at":null,"body":"```csharp\r\nthis.entity = Mock.Of<Entity>();\r\n\r\nMock.Get(this.entity).CallBase = true;\r\n\r\n// code...\r\n```\r\n\r\nvirtual method not call base method.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/moq/moq4/issues/comments/315182172","html_url":"https://github.com/moq/moq4/issues/419#issuecomment-315182172","issue_url":"https://api.github.com/repos/moq/moq4/issues/419","id":315182172,"user":{"login":"stakx","id":104481,"avatar_url":"https://avatars2.githubusercontent.com/u/104481?v=3","gravatar_id":"","url":"https://api.github.com/users/stakx","html_url":"https://github.com/stakx","followers_url":"https://api.github.com/users/stakx/followers","following_url":"https://api.github.com/users/stakx/following{/other_user}","gists_url":"https://api.github.com/users/stakx/gists{/gist_id}","starred_url":"https://api.github.com/users/stakx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stakx/subscriptions","organizations_url":"https://api.github.com/users/stakx/orgs","repos_url":"https://api.github.com/users/stakx/repos","events_url":"https://api.github.com/users/stakx/events{/privacy}","received_events_url":"https://api.github.com/users/stakx/received_events","type":"User","site_admin":false},"created_at":"2017-07-13T19:45:07Z","updated_at":"2017-07-13T19:45:07Z","body":"OK, after a few minutes of fiddling with your code to get it to work I think I see what you mean. Let me try to summarise your code:\r\n\r\n```csharp\r\n[Fact]\r\npublic static void CallBase_should_also_take_effect_when_mock_is_created_using_Mock_Of()\r\n{\r\n    var entity1 = new Mock<Entity>() { CallBase = true }.Object;\r\n    Assert.True(new MyTarget(entity1).IsValid);  // passes\r\n\r\n    var entity2 = Mock.Of<Entity>();\r\n    Mock.Get(entity1).CallBase = true;\r\n    Assert.True(new MyTarget(entity2).IsValid);  // fails\r\n}\r\n\r\npublic class MyTarget\r\n{\r\n    private Entity entity;\r\n\r\n    public MyTarget(Entity entity)\r\n    {\r\n        this.entity = entity;\r\n    }\r\n\r\n    bool IsValid => this.entity.VirtualProperty;\r\n}\r\n\r\npublic class Entity\r\n{\r\n    public virtual bool VirtualProperty => true;\r\n}\r\n```\r\n\r\nI suspect the difference in behavior here is due to `Mock.Of<T>()` setting up all properties while `new Mock<T>().Object` doesn't set up anything, but that's just a first guess; some more digging is required."}}
{"actor":{"display_login":"stakx"}}