Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads
 
Add your own
alternative version
Go to top

Unit Testing a DotNetNuke Private Assembly Module

, 18 Jun 2007
This article describes how to create unit tests that will test out code for a DotNetNuke custom module.
DnnUnitTesting_demo.zip
iFinity.DNN.Utilities.dll
DnnUnitTesting_src.zip
DnnUnitTesting
bin
DnnUnitTesting
bin
Debug
obj
Debug
Refactor
TempPE
Properties
DnnUnitTesting.vsmdi
iFinity.DnnUtilities
bin
Debug
Release
iFinity.DNN.Utilities.csproj.vspscc
obj
Debug
Refactor
TempPE
Release
TempPE
Properties
localtestrun.testrunconfig
TestResults
Bruce_WOMBAT 2007-06-08 09_08_45
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_10_02
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_11_13
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_15_14
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_16_18
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_16_52
In
WOMBAT
Out
Bruce_WOMBAT 2007-06-08 09_20_35
In
WOMBAT
Out
using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using iFinity.DNN.Utilities.Testing;
using DotNetNuke.Data;
namespace DnnUnitTesting
{
    /// <summary>
    /// Example DotNetNuke Unit Test Class
    /// </summary>
    [TestClass]
    public class MyDotNetNukeClassTest : DnnUnitTest 
    {
        public MyDotNetNukeClassTest() : base (1)  //send portal id to base class
        {
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void MyDotNetNukeSqlTest()
        {
            SqlDataProvider sqlProvider = new SqlDataProvider();
            int tabCount = sqlProvider.GetTabCount(this.PortalId);
            Assert.AreNotEqual(0, tabCount, "Portal has no tabs");
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bruce Chapman DNN
Product Manager DNN Corp
Australia Australia
Bruce Chapman is the Product Manager for Cloud Services at DNN. He’s been an active member of the DNN Community since 2006 as a contributor, vendor and now employee of DNN Corp.
 
You can read his blog at http://dnnsoftware.com/blog or follow him on Twitter @brucerchapman
Follow on   Twitter   Google+

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 19 Jun 2007
Article Copyright 2007 by Bruce Chapman DNN
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid