How can I call a method of the original class from the its fake class method

Polachan Paily 0 Reputation points
2023-02-02T05:06:24.5466667+00:00

I created a fake assembly called MyProject.Web.Customer.Fakes from the project MyProject.Web.Customer. I am trying to call Read method of the MyProject.Web.Customer from its fake object from the test method.The fake class there is a method I have given my code. I am trying to call the method 'Read()' using ShimCustObject.AllInstance.Read. I am looking for some one help. Thanks

{
   [Serializable]
   Public abstract class CustObject
   {
     public ArrayList Read()
     {
        return this.Read("Cust")
     }                                                                                                                                                   
     public ArrayList Read(string arrayattributes)
     {
        return this.Read("Cust")
     }    
   }
}
In Test project I am trying to call the method Read()

using microsoft.qualitytools.testing.fakes
using MyProject.Web.Customer
using MyProject.Web.Customer.Fakes

namespace MyProject.Web.Customer.Test
{
    [TestMethod]
    public void myTest()
    {
        using (ShimsContext.Create()) {
            //How can I call CustObject Read method using ShimCustObject.AllInstance.Read
        }
    }
}
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
335 questions
{count} votes