chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
When I run the below test, repos.Delete("Test") does not get called. However, I tried to isolate the repos.Delet(context, selector) method and wanted to check whether that method get's called by repos.Delete("Test"). So in the method repos.Delete("Test"), I instantiate a context and generate a selector wich I pass to repos.Delete(context, selector).

If I comment out the Isolate.WhenCalled method, repos.Delete("Test") get's called. So, the question is, does Isolate method overloading and signature resolution? Or did I just do something wrong??

        
[Isolated]
        [TestMethod]
        public void CallDeleteWithContextAndSelectorWhenDeleteByName()
        {
            var fakeContext = Isolate.Fake.Instance<GenFormDataContext>();
            Func<Test> fakeSelector = (x => x.name == "Test");
            var repos = new Repository<ITest>(fakeContext);

            Isolate.WhenCalled(() => repos.Delete(fakeContext, fakeSelector)).IgnoreCall();
            Isolate.NonPublic.WhenCalled(repos, "GetNameSelector").WillReturn(fakeSelector);

            repos.Delete("Test");
            Isolate.Verify.WasCalledWithAnyArguments(() => repos.Delete(fakeContext, fakeSelector));
        }
asked by halcwb (5.5k points)

2 Answers

0 votes
Hi,

Isolator fakes all overloads by default, you can workaround this by faking with "WithExacrArguments" before WillReturn.

Regards,
Elisha,
Typemock support
answered by Elisha (12k points)
0 votes
Worked like a charm, thank you very much.
answered by halcwb (5.5k points)
...