Ir al contenido principal

Unit Testing SharePoint 2010 con Visual Studio 2012 Ultimate

Para crear pruebas unitarias para código SharePoint 2010 se requiere de Visual Studio 2012 Premium/Ultimate que contiene el framework Microsoft Fakes,
Para realizar una prueba de como funciona seguí este ejemplo 

Sin embargo no encontré el código para compilarlo; por lo tanto cree un proyecto de web part visual, y agregué los métodos sobre los cuales se hacen las pruebas que aparecen en la página; allí vienen dos métodos de ayuda en la clase de pruebas que tampoco son listados y deben ser algo así:

public SPList AddListToSiteHelper(SPSite site)
        {
            // create a new temporary list              

            SPWeb web = site.RootWeb;
            var listId = web.Lists.Add("test", "test", SPListTemplateType.GenericList);
            SPList list = site.RootWeb.Lists[listId];
            Assert.IsNotNull(list);

            return list;
        }

private void AddItemsToListHelper(SPList list, string[] fields)
        {
            SPListItem item = list.Items.Add();
            item["Name"] = fields[0];
            item["Phone"] = fields[1];
            item["Email"] = fields[2];
            item["Age"] = fields[3];
            item["Date"] = fields[4];
            item.Update();
        }

También hay que verificar cuando creas el proyecto de Test que sea en el Framework 3.5, de lo contrario creo que no funcionará.

Comentarios

Entradas populares de este blog

Amazon EC2 - SharePoint 2010 Desarrollo

Estoy analizando si puedo montar mi propio SharePoint 2010 en Amazon EC2 aquí dos referencias valiosas para empezar: SharePoint 2010 Loggin Out of Control Para saber que opciones no habilitar y no generar mucho almacenamiento que mientras mayor mas te cobre AEC2. How to install SharePoint 2010 on ACE2 este link inclusive muestra los costos. Para tomar un curso en línea sería ideal, ya que contar con una computadora por ahora con esas características esta fuera de mi alcance por el momento. Aunque ya he visto varios blogs de gente que a montado sus ambientes de desarrollo en Windows 7 laptops con CoreDuo y 4 GB de memoria y esas configuraciones ya las puedes encontrar en las tiendas departamentales acá en Monterrey, N.L. Amazon EC2 Articles and Tutorials: Running SharePoint Services on AEC2 Amazon CE2 Pricing generalidades de sharepoint services en EC2. Doug Ware from Atlanta .NET User Group: Windows SharePoint Services on AEC2 Alternativas: The Rackspace Cloud : Windows Servers GoGrid

Changing Background GWorkspace

GWorkspace application in GNUstep, is like the equivalent to Nautilus under GNOME. It has interesting features that I'm beginning to love, right now I believe GNUstep is for UNIX-geek-old-fashioned. Here is the screenshot for changing the background image, you need to go to Info->Preferences->Desktop (drop down) then click Choose button for search the image. I'm running GNUstep compiled in Ubuntu 10.04 and the image comes from the folder / usr/share/backgrounds/ Another really cute functionality of GWorkspace is start applications from their installation folder, you need to open the viewer from menu View->Viewer and go to the installation application folder (in my case compiled from sources: /usr/local/lib/GNUstep/Applications ) then a double-click starts the application (*.app)