lundi 21 décembre 2015

Unit testing feature receiver with TypeMock

Using sharepoint and type mock how would I test the override FeatureActivated(); so that the returned fake type would actually have fakes filled out properties.

I currently have a solution where I get a fake SPFeatureRecieverProperties object returned, but when passing that into a call to my FeatureActivated method via unit test I get a System.NullReferenceException : Object reference not set to an instance of an object. exception.

How do I create this and test so that I can call the method with the fake parameters and tell if the call was successful?

This is what I have so far:

[Test]
        public void callFeatureActivating()
        {
            SPFeatureReceiverProperties fakeFeatureReceiverProperties = Isolate.Fake.Instance<SPFeatureReceiverProperties>();
            ManagerFeatureReceiver mFeatureReceiver = new ManagerFeatureReceiver();
            mFeatureReceiver.FeatureActivated(fakeFeatureReceiverProperties);
        }

Thanks

Aucun commentaire:

Enregistrer un commentaire