Unit Tests

Test code in Elevated privileges

25/03/2013 13:34
[TestInitialize] public void TestSetUpSettings() {     target = new CustomAscxUserControlHelper();       //Enable RunWithElevated privileges     var spSecMock =...

Ignore base call method

25/03/2013 13:27
//Ignore Call base.OnLoad and base.OnInit in Unit test //We use base.Onload in CustomAscxUserControl class //Double 'CallBase.CallBase' is used because CustomAscxUserControlHelper inherits from CustomAscxUserControl.   var mock =...

Verify private method was called

20/10/2012 23:53
ClearCache(properties) is private static void function of ContactListReceiverClass   //Verify private static method was called Isolate.Verify.NonPublic.WasCalled(typeof(ContactListReceiverClass),"ClearCache").WithArguments(properties);   //In case it's instance...

Test - call private method, or private static method

20/10/2012 21:55
  //var underTest = new ContactListReceiverClass(); //Invoke normal method             var result = Isolate.Invoke.Method(underTest, "ClearCache", properties);   //Invoke static method             var result =...

Call private method from abstract class

27/09/2012 21:44
    Using System.Linq;    public object InvokePrivate<T> (T instance, string methodName, params object[] obj)         {             var baseType = instance.GetType().BaseType;        ...

Get protected property value

27/09/2012 21:43
  //Create help public class   public class Class1 : MultiPageNavigationController  {  public Class1(INavigationConfiguration config) : base(config)  {  }  //create method to get...

Fake objects

Fake web part controls

25/03/2013 13:46

Expected Exception in Unit test

17/10/2012 16:36

Skuska kopirovania formatu

10/10/2012 12:07

Fake list and list item, query

10/10/2012 12:03

Fake private field

09/10/2012 16:41