Click here to Skip to main content
13,151,125 members (42,578 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads

Stats

63.1K views
676 downloads
35 bookmarked
Posted 7 Jun 2007

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.
iFinity.DNN.Utilities.dll
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

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 19 Jun 2007
Article Copyright 2007 by Bruce Chapman DNN
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid