How can I avoid having to call this extra method when running my unit test? I want somehow to have that context object created in the constructor to be used in the unit test
[TestMethod]
public void Delete_Sp_List()
{
ctx = tf.GetContext();
List list = ctx.Web.Lists.GetByTitle("StackTicketList");
list.DeleteObject();
ctx.ExecuteQuery();
}
public TicketForm()
{
SecureString ssPwd = new SecureString();
strPassword.ToList().ForEach(ssPwd.AppendChar);
SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(strUserName, ssPwd);
ctx.Credentials = credentials;
}
public ClientContext GetContext()
{
SecureString ssPwd = new SecureString();
strPassword.ToList().ForEach(ssPwd.AppendChar);
SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(strUserName, ssPwd);
ctx.Credentials = credentials;
return ctx;
}