System.MissingMethodException RRS feed

  • Question

  • I am testing a VSTO based excel application. I am getting System.MissingMethodException when I try to test following method-

        public bool SomeMethod(ListObject listObject)
          if (listObject != null)
            <strong>string matrixName = listObject.Name;</strong>

    Bolded line above is where the test is failing with System.MissingMethodException.

    Test method-

        public void SomeMethodTest()
          SListObject listObjectMole = new SListObject();
          string name = "test";
          listObjectMole.NameGet = () => name;
          SampleExcelClass target = new SampleExcellass(); 
          bool actual = target.SomeMethod(listObjectMole);


      When I debug the test code I see that the property 'Name' for listObjectMole is set to "test". However, in the method under test the listobject has this exception thrown under the property. 




    Friday, March 4, 2011 4:47 AM

All replies

  • This issue is usually related to embedded interop types. Is ListObject imported from a COM assembly?
    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    Tuesday, March 15, 2011 5:46 AM