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
+1 vote
I'm working with the Autodesk Inventor SDK Com Interop library.

I've got a test set up where I need to return a mocked object from an indexed accessor but it gives me null instead of what I set it up to return:

            var drawing = Isolate.Fake.Instance<DrawingDocument>();
            var sheets = Isolate.Fake.Instance<Sheets>();
            var sheet = Isolate.Fake.Instance<Sheet>();
            Isolate.WhenCalled(() => sheets[null]).WillReturn(sheet);
            var testSheet = drawing.Sheets[1];
            testSheet.Activate();

that last line throws an exception because testSheet is null. What am I doing wrong with this?
asked by ajw1970 (1.1k points)
reshown by leahtypemock

Please log in or register to answer this question.

...