- dnnunittesting_src.zip
- DnnUnitTesting
- bin
- DnnUnitTesting.sln
- DnnUnitTesting.vsmdi
- DnnUnitTesting
- iFinity.DnnUtilities
- localtestrun.testrunconfig
- Readme.txt
- TestResults
- Bruce_WOMBAT 2007-06-08 09_08_45
- Bruce_WOMBAT 2007-06-08 09_10_02
- Bruce_WOMBAT 2007-06-08 09_11_13
- Bruce_WOMBAT 2007-06-08 09_15_14
- Bruce_WOMBAT 2007-06-08 09_16_18
- Bruce_WOMBAT 2007-06-08 09_16_52
- Bruce_WOMBAT 2007-06-08 09_20_35
- dnnunittesting_demo.zip
- iFinity.DNN.Utilities.dll
|
/*
*
* iFinity Smart Business Solutions - http://www.ifinity.com.au
* Copyright (c) 2007
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), the rights to use, copy, modify, merge, publish, distribute, sublicense
* copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
* following conditions:
* 1. The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
* 2. The software may not be claimed as the original work and may not be sold as a stand alone product
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using DotNetNuke.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace iFinity.DNN.Utilities.Testing
{
public class DnnUnitTest
{
SqlDataProvider _sqlProvider;
TestContext testContextInstance;
int _portalId;
public TestContext TestContext
{
get { return testContextInstance; }
set { testContextInstance = value; }
}
public int PortalId
{
get
{
return _portalId;
}
}
public DnnUnitTest(int portalID)
{
DnnUnitTestSection dnnUnitTest = (DnnUnitTestSection)ConfigurationManager.GetSection("iFinity/dnnUnitTest");
if (dnnUnitTest == null)
throw new System.Configuration.ConfigurationErrorsException("The iFinity/dnnUnitTest section was not found in the config file");
UnitTestHelper.SetHttpContextWithSimulatedRequest(dnnUnitTest.SimulatedServer, dnnUnitTest.AppName, dnnUnitTest.AppPath, dnnUnitTest.SimulatedPage);
DotNetNuke.Common.Globals.ServerName = dnnUnitTest.SimulatedServer;
DotNetNuke.Common.Globals.HostMapPath = dnnUnitTest.HostMapPath;
DotNetNuke.Common.Globals.ApplicationPath = dnnUnitTest.AppPath;
DotNetNuke.Entities.Portals.PortalAliasInfo objPortalAliasInfo = new DotNetNuke.Entities.Portals.PortalAliasInfo();
objPortalAliasInfo.PortalID = portalID;
DotNetNuke.Entities.Portals.PortalSettings ps = new DotNetNuke.Entities.Portals.PortalSettings(-1, objPortalAliasInfo);
System.Web.HttpContext.Current.Items.Add("PortalSettings", ps);
_sqlProvider = new SqlDataProvider();
_portalId = portalID;
}
}
public class DnnUnitTestSection : ConfigurationSection
{
[ConfigurationProperty("hostMapPath", DefaultValue = "C:\\DotNetNuke", IsRequired = true)]
public string HostMapPath
{
get { return (string)this["hostMapPath"]; }
set { this["hostMapPath"] = value; }
}
[ConfigurationProperty("appName", DefaultValue = "DotNetNuke", IsRequired = true)]
public string AppName
{
get { return (string)this["appName"]; }
set { this["appName"] = value; }
}
[ConfigurationProperty("appPath", DefaultValue = "C:\\DotNetNuke", IsRequired = true)]
public string AppPath
{
get { return (string)this["appPath"]; }
set { this["appPath"] = value; }
}
[ConfigurationProperty("simulatedServer", DefaultValue = "localhost", IsRequired = true)]
public string SimulatedServer
{
get { return (string)this["simulatedServer"]; }
set { this["simulatedServer"] = value; }
}
[ConfigurationProperty("simulatedPage", DefaultValue = "Default.aspx", IsRequired = true)]
public string SimulatedPage
{
get { return (string)this["simulatedPage"]; }
set { this["simulatedPage"] = value; }
}
}
}
|
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.