mercredi 29 juillet 2015

How to mock this class

class A
{
public:
    void doFirstJob() 
    {
        // Do first Job.
    }
}

class B : public A
{
public:
    virtual void doSecondJob()
    {
        // Do Second Job.
    }
}

class C
{
public:
    void doSomething() {
        b->doFirstJob();
        b->doSecondJob();
    }
private:
    B* b;
}

Now I should write unit test code for class C, then I'll write a mock for class B, but the problem is how to mock the method doFirstJob().

Can any one help me ??

Aucun commentaire:

Enregistrer un commentaire